List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 4 2005 6:42pm
Subject:Re: INSERT DATE using USA Date Format
View as plain text  
In the last episode (May 04), Michael J. Pawlowsky said:
> I have some data where the date is already in USA format
> (MM-DD-YYYY). I would like to be able to insert this data without
> having to massage the date in the code.

MySQL seems to think that USA format is "MM.DD.YYYY", which I've never
seen before :)
> Is there a way to specify the Date Format for an INSERT statement?
> Something like:
>  INSERT INTO tblMyTable(myDate) VALUES(DATE_FORMAT('USA', '12-31-2004');

Try the STR_TO_DATE function:

SELECT STR_TO_DATE('12-31-2004','%m-%d-%Y');

	Dan Nelson
INSERT DATE using USA Date FormatMichael J. Pawlowsky4 May
  • Re: INSERT DATE using USA Date FormatDan Nelson4 May
    • Re: INSERT DATE using USA Date Format SOLUTIONMichael J. Pawlowsky4 May