SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL Date mismatch – Help needed for migrating website content database

    I am in the early stages of migrating content from a now unsupported CMS system to Wordpress. I am able to migrate the content including Subject, article, author, post ID, and all that good stuff that I need, but the post date is giving me major problems. The issue is that the old application stores the date in a different format.

    `date` varchar(100) NOT NULL default '',

    While Wordpress stores 2 dates:

    `post_date` datetime NOT NULL default '0000-00-00 00:00:00',
    `post_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',

    The result upon import is that all my dates show up as “0000-00-00 00:00:00” and I then would have to manually transfer the dates. Due to the high number of articles/postings this would be a nightmare.

    1) Any MySQL guru here who knows how I could work around that problem?

    Or

    2) If it is impossible to migrate the dates through MySQL manipulation, what would be a query that at least goes and let’s me make a mass change for anything that shows a date like “0000-00-00 00:00:00” and change it to the start date of my website?

    Thanks.

    Christoph

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    the easiest approach would be to use the STR_TO_DATE function while loading
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •