WordPress.org

Ready to get started?Download WordPress

Forums

Incorrect timezone offset when formatting time (3 posts)

  1. poodlerat
    Member
    Posted 4 years ago #

    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?

  2. poodlerat
    Member
    Posted 4 years ago #

    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.)

  3. mpclark
    Member
    Posted 4 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic