Jquery CountUP timer from specific date -


i need countup timer specific date. (year, month, day, hour, min., sec.,)

for example need count timer date 2012 august 24, , when refresh page, timer must still work/count up.

i found many counter every counter down, not up.

this timerlook http://flipclockjs.com/

but missing count specific date.

well, since you've mentioned flipclock, guess should work:

calculate difference between current date , desired date:

var date1 = new date("8/24/2012"); var date2 = new date(); var timediff = math.abs(date2.gettime() - date1.gettime()); var diffseconds = math.ceil(timediff / 1000); 

create flipclock (it counts default, change set countdown: true):

var clock = $('.your-clock').flipclock({     // ... options here }); 

use settime() method set time:

clock.settime(diffseconds); 

now start clock:

clock.start(); 

i haven't checked this, should work according documentation.

edit:

since flipclock doesn't support nothing beyond 99 days, here approach countdown.js:

setinterval(function() {     var timespan = countdown(new date("08/24/2012"), new date());     var div = document.getelementbyid('time');     div.innerhtml = "time difference 08/24/2012 " + timespan.years + " years, " + timespan.months + " months, " + timespan.days + " days, " + timespan.hours + " hours, " + timespan.minutes + " minutes, " + timespan.seconds + " seconds." }, 1000); 

see demo.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -