WordPress.org

Support

Support » How-To and Troubleshooting » Pre- 1970 dates no longer handled correctly

Pre- 1970 dates no longer handled correctly

  • WordPress used to correctly display post dates even if they were in the 1970’s or 1960’s. Since 2.8, posts with a date in the 1960’s are given today’s date.

    So for example in the Archives list in the sidebar, I have ‘September 1966’. Clicking on this hyperlink takes me to a page headed ‘Archive for July, 2009’ when it should say ‘Archive for September 1966’. All the posts in this archive show the date as ‘Saturday, July 11th, 2009’.

    What should I modify so that post_date in the Table wp_posts is correctly displayed like before?

Viewing 11 replies - 1 through 11 (of 11 total)
  • I don’t know why it would have worked before, but it looks like 2.8+ uses UNIX time to handle dates which starts at 00:00 01/01/1970.

    I think you are right. But dates are stored in the MySQL database as a string eg ‘1965-08-30 10:44:39’ and WordPress understands them, otherwise it wouldn’t be able to sort posts correctly. It just has a problem displaying the post date.

    I wonder why it defaults to today’s date, not 01/01/1970? Is there a line which checks for an invalid or missing datestamp and helpfully inserts ‘today’ if it finds one?

    I’m having the same problem.

    I’m guessing this has to do with “wp-includes/functions.php Revision 10407 -> Revison 10408”
    (Optimizations for mysql2date() http://core.trac.wordpress.org/ticket/8166)

    the previous version of mysql2date(Revision 10407) worked fine but
    this one(Revison 10408) haven’t work it out.

    wonder why it defaults to today’s date, not 01/01/1970? Is there a line which checks for an invalid or missing datestamp and helpfully inserts ‘today’ if it finds one?

    date_i18n (called mysql2date () in wp-includes/functions.php)?

    / Sanity check for PHP 5.1.0-
    if ( false === $i || intval($i) < 0 ) {
    if ( ! $gmt )
    $i = current_time( ‘timestamp’ );
    else
    $i = time();
    // we should not let date() interfere with our
    // specially computed timestamp
    $gmt = true;
    }

    Commenting out that code certainly works for me

    My problem is just the opposite my date defaults to Jan 1 1970.

    Oh great, I am having similar issues.

    My site displays archives dating back to 1940s. The perm link properly displays ie date/1947/09/

    The header however reads Archive December 2009 (always present date als the posts always get rendered with TODAYS date). When I click to edit post publication date … the fields show proper date ie. September 12, 1947. However, it doesn’t get displayed as publication date on post.

    However, the september 1947 archive is only posing as a DECEMBER 2009 archive as it is not identical to the TRUE september 2009 archive. The post belonging to that archive is displayed and ordered properly as the very first blog post at the end, where it is expected. But all post prior to 1970 are displayed with todays date yet ordered appropriately according to their desired publication date.

    I would love to find out how to display the date according to which they are ordered.

    any help would be appreciated.

    Oh thanks, commenting that code out worked like a charm.

    Thanks, worked for me too!

    What’s really annoying is this fix is due to a bug in Windows. Surely breaking WP on linux to support Windows is insane?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Pre- 1970 dates no longer handled correctly’ is closed to new replies.
Skip to toolbar