开发者

How to get jquery count down timer working properly

开发者 https://www.devze.com 2023-01-17 01:32 出处:网络
I am using jquery countdown timer. The timer runs well till 12 noon after that its not running. When i give parameters in 24hr format timer is running after 12 noon but not before. Where am I wrong?

I am using jquery countdown timer. The timer runs well till 12 noon after that its not running. When i give parameters in 24hr format timer is running after 12 noon but not before. Where am I wrong?

    jQuery(function () {
        jQuery('#countDowntimer').countdown({
            until: jQuery.countdown.UTCDate(+330, '#{time.year}',
                    '#{time.month}', '#{time.date}',
                    '#{time.hours}', '#{time.minutes}',
                    '#{time.seconds}', 0),
            compact: true, onExpiry: liftOff});
    });


Date startDate = 'Sep 开发者_StackOverflow社区23 14:00:00';
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.HOUR, 1);
StartTime time = new StartTime();

time.setYear(calendar.get(Calendar.YEAR));
time.setMonth(calendar.get(Calendar.MONTH));
time.setDate(calendar.get(Calendar.DATE));
time.setHours(calendar.get(Calendar.HOUR));
time.setMinutes(calendar.get(Calendar.MINUTE));
time.setSeconds(calendar.get(Calendar.SECOND));


jQuery.countdown.UTCDATE uses a 0-based index for month, whereas Calender uses a 1-based index. Try updating the code where you update your month to:

time.setMonth(calendar.get(Calendar.MONTH) - 1);

0

精彩评论

暂无评论...
验证码 换一张
取 消