Jump to content

Date conversion


unrelenting

Recommended Posts

I need to convert these date formats to what's after the equal sign so that I can import them into a date column in mysql. It won't take them as they are. Some of the dates go back to the 1800's so I can't use timestamps which is what I prefer....

 

9/5/1992  =  1992-09-05

12/15/1876  =  1876-12-15

 

etc..

Link to comment
https://forums.phpfreaks.com/topic/120131-date-conversion/
Share on other sites

well do something like this

$timestamp=whatever your timestamp is that is in your database or were ever you are storing them

$newtime=date('Y-M-d', $timestamp);

 

 

 

They aren't timestamps. They are formatted like the date on the left of the equal sign up above. The timestamp only works on dates after 1970. Most of mine are before that so I needed to convert them without moving them to the timestamp format.

 

Anyway, I got it done in Excel fairly easily so I don't need this conversion anymore but I was curious how it could be done.

Link to comment
https://forums.phpfreaks.com/topic/120131-date-conversion/#findComment-618901
Share on other sites

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.