Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

javascript - How to set timezone in jquery countdown timer

I want to set GMT+5:30 as my timezone in jquery countdown. Start Time for countdown is 'Thu May 20 16:00:00 IST 2010' End Time is 'Thu May 20 17:00:00 IST 2010' as value.

+330 is my timezone given in minutes. But my countdown starts from 00:35:00. I would have expected the countdown to start from 01:00:00 Not sure why this is discrepancy is there.

    <script type="text/javascript">
        $(function () {
            var endTime = '#{myBean.getCountDownDate()}';
            $('#defaultCountdown').countdown({
                until: endTime, format: 'HMS',
                timezone: +330,
                compact: true, description: '#{myBean.getCountDownDate()}'});
        });
    </script>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When using the until parameter the countdown plugin counts down until that time.

This will run for one hour using the correct offset.

$('#countdown').countdown({
    until: $.countdown.UTCDate(+330, 2010, 6-1, 20, 17),
    format: 'HMS',
    compact: true
});

Since 2010:06:20:17 has already passed it will display 00:00:00.

I would bet the reason you got 00:35:00 in your countdown is that you were looking at it around 2010:06:20:16:25.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...