skadet Posted June 20, 2007 Share Posted June 20, 2007 Hi, I have imported some data into an existing MySQL database. The old data had dates stored as YYYY-DD-MM -- the table stores data as YYYY-MM-DD. I need a way to change the values to fix this. Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/56427-eu-to-us-dates/ Share on other sites More sharing options...
Wildbug Posted June 20, 2007 Share Posted June 20, 2007 Where were you importing the data from? You could write a quick-n-dirty Perl script to match and switch the date strings if you have some kind of import text file. Quote Link to comment https://forums.phpfreaks.com/topic/56427-eu-to-us-dates/#findComment-278735 Share on other sites More sharing options...
bubblegum.anarchy Posted June 21, 2007 Share Posted June 21, 2007 Define the format in mySQL with str_to_date() UPDATE table SET date = date_format(str_to_date(date, '%Y-%d-%m'), '%Y-%m-%d') Quote Link to comment https://forums.phpfreaks.com/topic/56427-eu-to-us-dates/#findComment-278988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.