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