WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Post date from RSS import (4 posts)

  1. tedinoz
    Member
    Posted 7 years ago #

    I am importing articles as posts via RSS import (workaround so to search on the articles). The date of the articles could be anywhere between 1590 and 2006, though the vast majority are in 20th century.

    The import works great but the post time seems always to be the current date/time. I can make categories on the fly for the article year and dd-mmmon, but I'm thinking that it might also be helpful (for administration) in the long run if the post time was the relevant day/date for each of the articles.

    I'd appreciate any thoughts on the day/date issue and/or suggestions about how to "fix" it if necessary.

  2. tedinoz
    Member
    Posted 7 years ago #

    OK, folks
    I went ahead and had a go.
    I found that there is nothing "holy" about the post date, so I dumped my transactions out to Excel, changed the dates, and imported them back via phpMyAdmin.
    Took a while but it's OK now.
    There was a date issue pre-1970, but I followed a hack given on this site and it was fixed in no time.
    Ted

  3. whallify
    Member
    Posted 7 years ago #

    What hack did you use? I'm finding the "Search feature" on this wordpress site none-too-feature rich. I'm trying to find out why all my RSS2.0 blog entries that I'm importing into wordpress 2.0.4 all have 1969 dates (actually, it ends up being midnight, jan 1, 1970 GMT but of course displayed in my time zome).

    I've checked that <pubDate> tags in my original blog are correct, and they are.

    Example:
    <pubDate>Sat, 26 Aug 2006 11:46:45 0-500</pubDate>

    The rss import code is basically doing this:

    preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date);
    $post_date = strtotime($post_date[1]);
    $post_date = gmdate('Y-m-d H:i:s', $post_date);


    so I'm not sure if maybe my php isn't working right or what. But I checked the database and it's actually putting in the bad dates (1969 minus my time zome).

    Anyone have a fix? I have hundreds of entries, so this Excel workaround isn't great for me (unless I'm missing a more automated way).

  4. whallify
    Member
    Posted 7 years ago #

    ok, I figured it out. I wrote a quick "test" php script that tested strtotime on the dates that were coming from my RSS feed (I was using MyBloggie) and it was returning -1. So I changed my rss.php from mybloggie to just hardcode "CST" as the timezone and now it's working great.

    So the problem was my source RSS feed, not the import script.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags