The Little Guy Posted August 21, 2010 Share Posted August 21, 2010 I need to convert a column to a timestamp, anyone know of a good way to do this with out losing the dates (times don't matter)? The current format is like so: mm/dd/yyyy Link to comment https://forums.phpfreaks.com/topic/211388-convert-date-to-a-valid-timestamp/ Share on other sites More sharing options...
fenway Posted August 22, 2010 Share Posted August 22, 2010 STR_TO_DATE() -- but don't store DATE values in CHAR fields. Link to comment https://forums.phpfreaks.com/topic/211388-convert-date-to-a-valid-timestamp/#findComment-1102216 Share on other sites More sharing options...
The Little Guy Posted August 22, 2010 Author Share Posted August 22, 2010 Will this work: UPDATE comments SET STR_TO_DATE(date,'%m/%d/%Y') date is the column name Link to comment https://forums.phpfreaks.com/topic/211388-convert-date-to-a-valid-timestamp/#findComment-1102315 Share on other sites More sharing options...
fenway Posted August 22, 2010 Share Posted August 22, 2010 You can -- and should -- easily check with an equivalent select. And don't use a reserved keyword for a column name. Link to comment https://forums.phpfreaks.com/topic/211388-convert-date-to-a-valid-timestamp/#findComment-1102382 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.