Ticket #5337 (new defect)

Opened 1 year ago

Last modified 1 year ago

Wrong timezone with comment_time and the_time since DST ended

Reported by: jrawle Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: General Version: 2.3.1
Severity: normal Keywords: time date timezone dst utc
Cc: wordpress@jonathanrawle.co.uk

Description

I am designing a theme where I want the current timezone to be displayed after the time in comment and post timestamps. For example, I use <?php comment_time() ?> with my default time format set to H:i T.

I am in the UK, and until the clocks changed on 28 October everything was fine. Posts or comments written during a summer gave the time as e.g. "14:00 BST" while those written in the winter said "13:00 GMT".

However, since BST ended, I now see "UTC" for all datestamps, irrespective of whether they were posted during the summer or winter. So the two examples given above would now show "14:00 UTC" and "13:00 UTC" respectively, despite the fact that the first one is incorrect. I also don't understand why it switched from using GMT to UTC.

I do not know whether this bug is present in other timezones.

Change History

11/12/07 09:52:16 changed by jrawle

  • keywords set to time date timezone dst utc.
  • milestone changed from 2.3.2 to 2.4.

From the PHP manual http://www.php.net/mktime :

is_dst

This parameter can be set to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown whether the time is within daylight savings time or not. If it's unknown, PHP tries to figure it out itself. This can cause unexpected (but not incorrect) results.

The parameter is deprecated in PHP 5.1.0 and "the new timezone handling features should be used instead."

For servers in the UK, it seems PHP is "figuring out" that they are on British time in the summer, but in the winter it gets it slightly wrong and assumes the machine is permanently on UTC (hence UTC not GMT).

Perhaps this should be addressed in Wordpress along with other issues surrounding timezones, for example automatic DST?

Other timezones could be affected if PHP makes the wrong guess as to the timezone.

11/12/07 20:59:59 changed by lloydbudd

  • milestone changed from 2.4 to 2.5.