Support » Fixing WordPress » WP time is an hour off

  • not sure if this is an issue with WP, or the plug-in “ Stats”, so my apologies if I’m in the wrong spot.

    since daylight savings kicked in a few weeks back, my blog’s stat’s have been an hour off, starting the new day at 11pm (23:00) rather than waiting for midnight. the posts all show the correct time, and if i go to publish a post at tuesday at 11:35pm, it will show as a tuesday post, not wednesday. however, the stats for that post will be added to the next day.

    in general settings, I’ve selected NEW YORK as the city I’m in (and I am!). with that, it shows:
    UTC time is 2010-11-15 4:03:07
    Local time is 2010-11-14 23:03:07
    (that is correct)
    This timezone is currently in standard time.

    should i be exploring the stats plugin further, or is the error with something else…?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Mark Ratledge


    Forum Moderator

    WP will show server time. Where’s your server? Somewhere without DST?

    hi SDT, thanks for the response

    the server is in texas somewhere, so certainly within a DST zone. beyond that, the WP settings page shows that the site IS picking up the correct, adjusted time. it’s really just the integrated stats that seem to be misreading the clock.

    The stats plugin does not currently support the offset change caused by daylight savings.

    When you select a time zone using a city name, WordPress relies on the server OS to shift your UTC offset on the correct day. This shifts the offset for all dates. Confusingly, this means that if you posted something at 3:00 on a summer afternoon, when you check it in the winter it says it was posted at 2:00. See, WordPress doesn’t even correctly support time zones.

    The correct way to support time zones is to compute the offset for each time according to its date. This means that there are two odd-length days each year: one has 23 hours, the other has 25.

    The Stats plugin sweeps the whole issue under the rug. When you set your time zone by city, the plugin sends the associated offset (including the DST hour if applicable for your time and place) and sends it to the server. That’s the offset that is used to show your reports. You can change it by resetting your time zone; change it, then change it back. The new offset will be used.

    If you want your reports to follow daylight savings time, you’re actually asking for all of your reports to be shifted by one hour because, like WordPress, the stats system uses the same offset for all dates (no 23- or 25-hour days). Some users, after fixing their DST offset, have noticed that the numbers changed slightly on all previous days.

    We store the stats data per hour in UTC time. So when you ask for your stats report, each day’s total is computed from 24 rows in the database and if you have a time zone offset, those rows actually span two dates. When you change your offset, it changes which 24 rows make up the day. Thus the numbers change slightly.

    It’s up to you whether you want your stats to follow your time zone. It doesn’t change the underlying data; only the reports look different. Maybe in the future we’ll support those 23- and 25-hour days, but I’m not looking forward to it.

    What I do, because I’m a DST curmudgeon, is use one of the UTC offset time zones at the bottom of the list. Those don’t respect daylight savings at all. We can’t all live in Arizona, but we can do our part to say “DST is stupid and I’m not playing along.”</editorial>

    hah – that sounds about right, andy. thanks for the tip, i’ll set it up now!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP time is an hour off’ is closed to new replies.