Connecting Tech Pros Worldwide Help | Site Map

Date format

  #1  
Old August 18th, 2008, 09:15 PM
Donald Campbell
Guest
 
Posts: n/a

I am looking at moving some old database systems to MySQL and I am
currently working on data loading using mysqlinport.

I have an issue with dates as all the data that is coming my way has
dates in DD/MM/YYYY. the load routines look to only accept it in
YYYY/MM/DD.

Is there anyway of telling the routines to use the European date format?

Would be nice if it could display dates in the format as well.

I did find a variable called "data_format" in the online documentation,
however, it said that it was no-longer used.

THanks.

Don

  #2  
Old August 18th, 2008, 10:55 PM
Gordon Burditt
Guest
 
Posts: n/a

re: Date format


>I am looking at moving some old database systems to MySQL and I am
Quote:
>currently working on data loading using mysqlinport.
>
>I have an issue with dates as all the data that is coming my way has
>dates in DD/MM/YYYY. the load routines look to only accept it in
>YYYY/MM/DD.
My suggestion is not to try to fight MySQL in terms of how the data
is *stored*. Using date_format(), you can get the data out of the
database in one of an incredible number of formats. Using str_to_date(),
you can convert input in lots of formats to a date, provided you know
what format is coming in.
Quote:
>Is there anyway of telling the routines to use the European date format?
I'm not that experienced in the use of mysqlimport, but I believe you
can import the files like this:

1. Set up your table, with string fields for the dates.
2. Do the import.
3. Add date fields to the table.
4. Fill the date fields from the corresponding string fields, using
something like
UPDATE table SET datefieldname = str_to_date(stringfieldname, '%d/%m/%Y');
Repeat if you've got more than one date field you're trying to import.
5. Drop the string fields.

  #3  
Old August 18th, 2008, 10:55 PM
Tim Streater
Guest
 
Posts: n/a

re: Date format


In article <SI$AnlAoddqIFAJo@suedonltd.demon.co.uk>,
Donald Campbell <suedon@suedon.co.ukwrote:
Quote:
I am looking at moving some old database systems to MySQL and I am
currently working on data loading using mysqlinport.
>
I have an issue with dates as all the data that is coming my way has
dates in DD/MM/YYYY. the load routines look to only accept it in
YYYY/MM/DD.
>
Is there anyway of telling the routines to use the European date format?
>
Would be nice if it could display dates in the format as well.
No, you have to write some PHP or JavaScript (or both, as I did) to
reformat it to/from internal format from/to human format. While you're
at it make it flexible, so it allows any delimiter rather than just the
slash, allows month names as well as month numbers, and makes some sort
of guess about what 2-digit years mean.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Format and using database in various countries ARC answers 10 September 16th, 2007 05:45 PM
changing the date format in vb.net andreas answers 20 June 16th, 2006 03:15 PM
Date Format Macca answers 5 November 13th, 2005 07:12 AM
More date format grief Simon Brooke answers 15 July 20th, 2005 02:41 AM
changing date format in update statement jt answers 1 July 19th, 2005 10:24 PM