patsfans Posted May 27, 2010 Share Posted May 27, 2010 I need to pull the dates for my articles out of my database which are formatted like this: August 18, 2002 and then convert them over to this: $date = "2002-08-18 00:00:00"; I never wrote code to create the timestamp each time the articles were added, but now am in need of making some changes and need to query the dates, and have it insert the timestamp via an UPDATE into the new cell. What's the easiest way to convert the date into a timestamp? Ian Link to comment https://forums.phpfreaks.com/topic/203120-date-conversion-to-time-stamp/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 27, 2010 Share Posted May 27, 2010 http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_str-to-date Link to comment https://forums.phpfreaks.com/topic/203120-date-conversion-to-time-stamp/#findComment-1064279 Share on other sites More sharing options...
patsfans Posted May 27, 2010 Author Share Posted May 27, 2010 Everything on that page is terrific - except for the fact that I need to do it in reverse I need to convert: "August 18, 2002" to "2002-08-18 00:00:00"; Everything there shows how to extract numeric dates and reformat them - but I can't find an example of doing it in reverse. I'm guessing it's probably easy - so any help you can provide would be most appreciated Link to comment https://forums.phpfreaks.com/topic/203120-date-conversion-to-time-stamp/#findComment-1064283 Share on other sites More sharing options...
patsfans Posted May 27, 2010 Author Share Posted May 27, 2010 The answer to this question is here: http://www.phpfreaks.com/forums/index.php/topic,299408.0.html Link to comment https://forums.phpfreaks.com/topic/203120-date-conversion-to-time-stamp/#findComment-1064326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.