• poodlerat

    (@poodlerat)


    I’m trying to format a date in ISO 8601 format for posts within the loop using datetime="<?php the_time('c'); ?>".

    My timezone is set to Toronto, which is UTC-0400, but the output I get is 2010-03-21T03:12:00+00:00. It’s the correct date/time for the post (which are posting correctly with the date/time for my timezone) but without the correct timezone offset.

    When I use the_time('P') I get the same problem. Does anyone know why it’s not honouring my set timezone offset, and instead reverting to UTC time when I ask for the timezone offset?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter poodlerat

    (@poodlerat)

    I tested PHP’s own date() function, and it also tells me that I’m using UTC time.

    Does anyone know if it’s possible that WordPress is using my server’s timezone offset rather than the one I specified? If so, it seems like a strange bug. Or is something else happening?

    (BTW, I get the same result with the_time() whether I set my timezone to Toronto or to UTC-04:00.)

    I’ve just noticed this too; I don’t seem to be able to persuade WordPress to put anything other than +00:00 into the time output by the_time('c'), regardless of the timezone the backend is set to. I too think this might be a bug…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Incorrect timezone offset when formatting time’ is closed to new replies.