stig1 Posted May 11, 2009 Share Posted May 11, 2009 How do i convert a date/time 0000-00-00 00:00:00 into a string, and then convert back to a date/time? Basically i would like to store date/time values in a varchar field instead of a date/time field in mysql. Link to comment https://forums.phpfreaks.com/topic/157647-date-time/ Share on other sites More sharing options...
Maq Posted May 11, 2009 Share Posted May 11, 2009 How do i convert a date/time 0000-00-00 00:00:00 into a string, and then convert back to a date/time? You have to use the date function. Basically i would like to store date/time values in a varchar field instead of a date/time field in mysql. Why? Link to comment https://forums.phpfreaks.com/topic/157647-date-time/#findComment-831318 Share on other sites More sharing options...
AmandaF Posted May 13, 2009 Share Posted May 13, 2009 In addition to PHP's date function, MySQL has a date_format function that does the same thing. You might find that that saves you from having to use varchar (you could store the date as a datetime and call date_format in the query). Link to comment https://forums.phpfreaks.com/topic/157647-date-time/#findComment-833366 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.