Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format Date From Text File into MySQL

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
GB
I am currently writing a script that will take info from a text file and put it into a MySQL database.

I can import all information from the text file into the database apart from dates.

The dates in the text file are in the format 06-DEC-05 and to get it into MySQL I need it in the format yyyy-mm-dd

I have tried the following and it doesn't work

Code:
date(Y-m-d,$datefromtextfile)

Thanking in advance for any help received
 
I should have done a bit more research before posting this question.

My solution is

Code:
date("Y-m-d",strtotime($datefromtextfile))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top