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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.