Importing dates from CSV

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Importing dates from CSV

Post by JayBird »

I have a CSV file where one column has a date in the format DD/MM/YY.

When i import this into a tinyblob field, it becomes YYYY-MM-DD HH:MM:SS.

How can i store it in the original format?

Im not bothered if it is actually seen as a date, i just need to grab it as a string in my PHP code.

Thanks

Mark
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

That was very wierd.
How do you read the CVS? I mean, where might the conversion string->datetime happen?

On a personal note, I'd use varchar(8) as the field as the size never would be less or more. Saves a couple of bytes...
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

I am using the GUI SQLyog to import the CSV.

I have set the colum to varchar, but i will try the length of 8 when i am at work tomorrow.

Mark
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Aha, using 3rd part software.
If you still experience problems, try using phpMyAdmin or MySQL-Front (GUI software) that also supports CVS's.
Perhaps it's an issue in the software. Just thoughts...
Post Reply