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 Quote 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. Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.