WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Date shows incorrect in WP 3.2 (11 posts)

  1. Old Cow
    Member
    Posted 2 years ago #

    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.

  2. Did you try turning off your plugins?

  3. Old Cow
    Member
    Posted 2 years ago #

    No, because the dates worked fine before upgrading WP.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    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.

  5. Old Cow
    Member
    Posted 2 years ago #

    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.

  6. AstroGremlin
    Member
    Posted 2 years ago #

    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/

  7. Old Cow
    Member
    Posted 2 years ago #

    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.

  8. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    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?

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 2 years ago #

    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')); ?>

  10. Old Cow
    Member
    Posted 2 years ago #

    Thanks Otto!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags