Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

What happens when you change your End Time format to 'Thu, 20 May 2010 17:00:00 IST'?

-edit-

It looks like you're not supposed to pass the date value to until as a String. You can pass in a Date to specify the exact date/time, but a string is only supposed to be used as a time offset, which is why you always get the same amount of time remaining when you refresh.

I couldn't get Date to convert the string with the 'IST' time zone, so I ended up using 'GMT+05:30'. I also put the timezone offset in terms of hours instead of minutes.

<scripttype="text/javascript">
$(function () {
    var endTime = "Tue, 29 Jun 2010 12:00:00 GMT+0530";
    $('#defaultCountdown').countdown({
        until: newDate(endTime), format: 'HMS',
        timezone: +5.5,
        compact: true, description: endTime.toString()});
});
</script>

Post a Comment for "How To Set Timezone In Jquery Countdown Timer"