MySQL Forums
Forum List  »  Newbie

Converting strings to dates
Posted by: David Taylor
Date: October 19, 2017 08:05AM

I have a CSV file which I have imported into MySQL using:
LOAD DATA LOCAL INFILE '$file' INTO TABLE $table FIELDS ENCLOSED by '\"' TERMINATED by ',' LINES TERMINATED BY '\n'

The dates in the CSV are of format dd/mm/yyyy but I want them in DATE format.

If I try editing the (extremely large) CSV file using Excel, it seems to add in lots of double quotes to some (but not all of the fields) so it then the import doesn't work.

I am hoping there is an SQL command I can run in PHPMyAdmin to convert the string format date to a formal date such that I can run date comparison queries in SQL.

Can anyone please tell me how to convert the column type to DATE and reformat the date strings contained in it without losing the data contained in that column?

Fingers crossed...

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Converting strings to dates
October 19, 2017 08:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.