BUG: PHP Timezone not set to Blog Timezone (6 posts)

  1. knightnet
    Posted 6 years ago #

    WP2.8.4 with PHP 5.2.6

    It appears the tag the_time() returns the date/time in the LOCAL SERVER timezone and NOT that specified in the admin/settings/general page.
    That is to say that I posted a new test post at 20:52 UTC with the blog set to use UTC timezone (in admin), changed the template to show the timezone the_time('jS M Y H:i e') and the date/time showed as "20:52 America/Los_Angeles".

    I've tried an auto and a manual setting. Changing the default timezone using php date_default_timezone_set().

    There is clearly a bug in WP that is not setting the PHP default timezone to match the timezone set in the admin interface.

    This will only affect blogs that are not in the same timezone as the server the blog is running from.

    Julian Knight

  2. Samuel B

    Posted 6 years ago #

    I'm in a different time zone than my server and the time works correctly
    i.e. UTC time is 2009-09-02 21:54:27 Local time is 2009-09-02 15:54:27
    so I'm -6 behind UTC and it works as set to -6

    I think you need to speak with your host

  3. knightnet
    Posted 6 years ago #

    Ah, some more information that may be relevant.

    My installation of PHP is running as FastCGI and therefore is not picking up server environment variables and the default.timezone is not set either. This may be the issue.

    Setting the TZ in .htaccess fixes the problem:
    SetEnv TZ Europe/London

    Now, setting the Blog TZ works correctly.

    This is still a bug though. It looks like changing the Blog TZ should force the correct TZ in .htaccess since the date & time that is returned by the_time() comes from the SERVER TIME/SERVER TZ

  4. knightnet
    Posted 6 years ago #

    Sorry, a BUG is perhaps overstating things.

    It seems to be a PHP CGI/FastCGI issue perhaps. Still we do have an issue and the_time() is certainly returning incorrect values.

    Once TZ is set to anything in .htaccess, the_time() seems to work OK.

  5. knightnet
    Posted 6 years ago #

    Correction to the above:

    I'd put some debugging code in the template.

    If I put the following line in index.php:

    Then the_time() works correctly. If I don't, it doesn't - that can't be right can it?

  6. ownmembers
    Posted 6 years ago #

    I'm new to administering this blog. I have no ability to change anything in the time area. It keeps showing up west coast time and I'm east coast. So I thought I'd just get rid of the time reference, but I can't do that either. Help.

    sharondanley@rogers.com Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic