jquery - How to execute strftime in javascript ? -


i making countdown counter user entering start date , duration , end date gets calculated. , based on end date countdown counter starts.

but issue here counter giving wrong output. number of months, days, hours, min, sec fine except year. think there wrong srftime command.

<script src="external/jquery/dateformat.min.js" type="text/javascript"></script> <script src="external/jquery/jquery.countdown.min.js" type="text/javascript"></script> <script src="jquery-ui.js" type="text/javascript"></script> <script type="text/javascript">     $(document).ready(function(){         $("#start_date").datepicker({ mindate: 0 });         $("#setcounter").on("click",function(){             var startdate = $("#start_date").val();             var duration = $("#period").val();             if (startdate == "" || duration == "") {                 alert("please fill fields.");                 return;             }             stopdate = new date(startdate);             stopdate.setmonth(stopdate.getmonth() + parseint(duration));             stopdate = dateformat.format.date(stopdate,"mm/dd/yyyy");             $("#end_date label").html(stopdate);             $("#end_date").show();              var today = dateformat.format.date(new date(),"mm/dd/yyyy");             todayobj = new date(today);             startdateobj = new date(startdate);             todaytimestamp = date.utc(todayobj.getfullyear(),todayobj.getmonth(), todayobj.getdate());             startdatetimestamp = date.utc(startdateobj.getfullyear(),startdateobj.getmonth(), startdateobj.getdate());              if (todaytimestamp >= startdatetimestamp) {                  $('#getting-started').countdown(stopdate, function(event) {                     $(this).html(event.strftime('%y year %m month %d days %h:%m:%s'));                  });             };         });     }); </script> 

my html code follows:

<div> <p>start date: <input type="text" id="start_date"></p> <p>period: <input type="text" id="period" placeholder="no. of months"></p> <p id="end_date">end date: <label></label></p> <p><input type="button" value="add counter" id="setcounter" /></p>   </div> <div id="getting-started"></div> 


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -