Jump to content

Date conversion to Time Stamp


patsfans

Recommended Posts

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

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.