• Resolved Old Cow

    (@old-cow)


    With the WP upgrade from 3.1.4 to 3.2, the date shows on all websites the next day. I did set the date correct in General Settings > Timezone.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Did you try turning off your plugins?

    Thread Starter Old Cow

    (@old-cow)

    No, because the dates worked fine before upgrading WP.

    Yes… and? Deactivating all plugins and switching to the Twenty Ten theme is the beginning of WordPress troubleshooting 101. If you can’t work with us, we can’t really help you.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Thread Starter Old Cow

    (@old-cow)

    I did check WP General Settings Date and Server date settings – all look good to me. I will check into the themes which generate the date display. The sites comply with the WP requirements.

    My post date appearance was reset by 3.2 installation. I had a custom setting showing only year (to save space per Yoast’s good advice). It was easy for me to reset in Settings>General to “Y”
    In Permalinks>Common settings I have if set to /%year%/%postname%/

    Check out my blog on being scared to switch, which mentions this. If this is the worst that happens to me, I’ll be delighted!
    http://blogsnewsreviews.com/2011/scared-to-upgrade-to-wp-3-2/

    Thread Starter Old Cow

    (@old-cow)

    After installing WP 3.2 the server date/time displayed on the sites with the function <?php echo date("F j, Y g:i a"); ?> shows the GMT (0). WP General Settings set to local date/time. The web-server has the correct location date/time. I did update permalinks. Still the GMT (0) is displayed.

    My post date appearance was reset by 3.2 installation. I had a custom setting showing only year (to save space per Yoast’s good advice).

    Where was this “custom setting”, in Dashboard -> Settings -> General, or directly in the Theme template? And, if in the Theme, what Theme are you using?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    WordPress intentionally sets the default timezone value to GMT, and has done so for several versions. This means that date() will always return values in GMT time. This is for both backwards compatibility and to give a standard and consistent date across both PHP 5 and PHP 4 platforms.

    Now that PHP 4 has been dropped, this may be corrected in the future (there’s a lot of code that needs to be adjusted and compatibility has to be maintained too). However, for the time being, date() is supposed to return GMT. If you need the local time, WP provides a function that can return the current time, adjusted by the WP selected timezone value.

    The current_time('timestamp') will return a unix timestamp. So your date call could be changed to this:

    <?php echo date("F j, Y g:i a", current_time('timestamp')); ?>

    Thread Starter Old Cow

    (@old-cow)

    Thanks Otto!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Date shows incorrect in WP 3.2’ is closed to new replies.