List:General Discussion« Previous MessageNext Message »
From:Gilles MISSONNIER Date:January 10 2007 7:19pm
Subject:how to take advantage of STR_TO_DATE
View as plain text  
Hello the list

I have a bunch of data that I load in the base through
the "load data infile" procedure.
These data contain date with the following date format :
%d/%m/%Y   [ that is day/month/year_4digit ]

I could rewrite the date with a script (perl, shell,)
to convert "day/month/year_4digit" into the standard MySQL format
that is "year_4digit-month-day", then load data in the base.

but I think I could take advantage of the STR_TO_DATE feature :


mysql> SELECT STR_TO_DATE('15/10/1999', '%d/%m/%Y');
+---------------------------------------+
| STR_TO_DATE('15/10/1999', '%d/%m/%Y') |
+---------------------------------------+
| 1999-10-15                            |
+---------------------------------------+


I don't know how to do it on the fly :
should I create an string colum, in which I put the date like 
"15/10/1999"
then run a mysql procedure that use STR_TO_DATE to fill a date column ?
how to do this ?

regards,

_-¯-_-¯-_-¯-_-¯-_
Gilles Missonnier
IAP - gimi@stripped
01 44 32 81 36
Thread
how to take advantage of STR_TO_DATEGilles MISSONNIER10 Jan
  • Re: how to take advantage of STR_TO_DATEViSolve DB Team11 Jan
    • Re: how to take advantage of STR_TO_DATEGilles MISSONNIER11 Jan
      • Re: how to take advantage of STR_TO_DATEJake Peavy11 Jan
        • Re: how to take advantage of STR_TO_DATEDan Nelson11 Jan
          • Re: how to take advantage of STR_TO_DATEJake Peavy11 Jan
  • Re: how to take advantage of STR_TO_DATEFelix Geerinckx11 Jan