MySQL Forums
Forum List  »  Newbie

Re: Importing data with dates AND times spearately
Posted by: Barry Galbraith
Date: July 18, 2016 10:21PM

Date and Time formats
http://dev.mysql.com/doc/refman/5.7/en/date-and-time-types.html

Seeing as you have dates as DD/MM/YY you can import and convdert these on the fly with STR_TO_DATE() by using a format string to tell MySQL what the format of your date is.
http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date

mysql> select str_to_date('19/07/2016', '%d/%m/%Y');
+---------------------------------------+
| str_to_date('19/07/2016', '%d/%m/%Y') |
+---------------------------------------+
| 2016-07-19                            |
+---------------------------------------+
1 row in set (0.00 sec)

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Importing data with dates AND times spearately
July 18, 2016 10:21PM


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.