Skip to content Skip to sidebar Skip to footer

Countdown Timer Not Working With Gmt Time

I have countdown which is not taking GMT time. i want it to have GMT time. It seems its using London time that is +1. live demo : http://ffsng.deewayz.in/countdown/ It seems Actual

Solution 1:

To get GMT/UTC date-time values, use gmdate instead of date.

$targetDateDisplay = gmdate($dateFormat,$targetDate);
$actualDateDisplay = gmdate($dateFormat,$actualDate);

The date function does two things:

First, it converts the Unix Timestamp (which is a UTC value anyway) into the computer local timezone. Secondly it then converts this local value into a string representation using the supplied format string.

The gmdate function, on the other hand, merely creates a string representation without doing any timezone conversion.

Solution 2:

For your second issue, I guess that a gmmktime instead of mktime will suits your needs (you should have a look to the documentation here).

Post a Comment for "Countdown Timer Not Working With Gmt Time"