WordPress.org

Ready to get started?Download WordPress

Forums

Pre- 1970 dates no longer handled correctly (12 posts)

  1. therapyindex
    Member
    Posted 5 years ago #

    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?

  2. Robert Simpson
    Member
    Posted 5 years ago #

    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.

  3. therapyindex
    Member
    Posted 5 years ago #

    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?

  4. gosunatxrea
    Member
    Posted 4 years ago #

    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.

  5. gosunatxra
    Member
    Posted 4 years ago #

    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;
    }

  6. andymc5202
    Member
    Posted 4 years ago #

    Commenting out that code certainly works for me

  7. suzy
    Member
    Posted 4 years ago #

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

  8. chartinael
    Member
    Posted 4 years ago #

    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.

  9. chartinael
    Member
    Posted 4 years ago #

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

  10. David Angel
    Member
    Posted 4 years ago #

    Thanks, worked for me too!

  11. gosunatxrea
    Member
    Posted 4 years ago #

  12. jtwg
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic