rugzo Posted June 14, 2009 Share Posted June 14, 2009 Hi all, in my table the dates are in 05.06.2009 03:36 that format and i have to change them into 2009-06-14 11:58 this. Can anyone help, i don't want to destroy the data. Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/162153-solved-date-format/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 14, 2009 Share Posted June 14, 2009 Backup your database. Add a new column to the table with a DATETIME data type. Use the mysql STR_TO_DATE() function in a single UPDATE query (a query without a WHERE clause will operate on all rows in the table) to populate the new column with the equivalent of the existing values. Modify and test your existing scripts to use the new column. Remove the old column. Quote Link to comment https://forums.phpfreaks.com/topic/162153-solved-date-format/#findComment-855700 Share on other sites More sharing options...
rugzo Posted June 14, 2009 Author Share Posted June 14, 2009 Like you said i only changed the format from text to date and it also changed the format automatically without doing anything else, thanks very much... Quote Link to comment https://forums.phpfreaks.com/topic/162153-solved-date-format/#findComment-855772 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.