playwright Posted October 11, 2010 Share Posted October 11, 2010 I have multiple datetimes. The format is dd-mm-yy, hh:mm. I want to insert it into a table using mysql. However mysql format is yy-mm-dd, hh:mm:ss. How can i do it and what type should i use (datetime?timestamp?). Thanks for your help!! Link to comment https://forums.phpfreaks.com/topic/215632-convert-datetime-format/ Share on other sites More sharing options...
AbraCadaver Posted October 11, 2010 Share Posted October 11, 2010 You probably want a four digit year, and use H for 24 hour time or h for 12 hour: $new_date = date('Y-m-d h:i:s', strtotime($old_date)); datetime or timestamp depends on what you need. You can read the differences here: http://dev.mysql.com/doc/refman/5.1/en/datetime.html Link to comment https://forums.phpfreaks.com/topic/215632-convert-datetime-format/#findComment-1121168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.