如何在jQuery倒数计时器中设置时区 [英] How to set timezone in jquery countdown timer

查看:91
本文介绍了如何在jQuery倒数计时器中设置时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将GMT + 5:30设置为jquery倒计时中的时区. 倒计时的开始时间是"IST 2010年5月20日星期四16:00:00" 结束时间的值是"IST 2010年5月20日星期四17:00:00".

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是我的时区(以分钟为单位). 但是我的倒计时从00:35:00开始. 我本来希望倒计时从01:00:00开始 不确定为什么存在差异.

+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>

推荐答案

使用until参数时,倒计时插件将一直递减计数.

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
});

从2010:06:20:17开始,它将显示00:00:00.

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

我敢打赌,您在倒计时中得到00:35:00的原因是您在2010:06:20:16:25左右观看它.

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.

这篇关于如何在jQuery倒数计时器中设置时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆