SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Mar 2001
    Highlands Ranch, Colorado
    0 Post(s)
    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?


    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?



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


Posting Permissions

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