MySQL Forums
Forum List  »  Newbie

Re: question about the date
Posted by: Barry Galbraith
Date: December 15, 2017 04:58PM

Dates are in the format yyyy-mm-dd in MySQL (thank goodness).

You can convert your strings that pretend to be dates to real dates with str_to_date()

https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date

mysql> SELECT str_to_date('01JAN2013', "%d%b%Y");
+------------------------------------+
| str_to_date('01JAN2013', "%d%b%Y") |
+------------------------------------+
| 2013-01-01                         |
+------------------------------------+
1 row in set (0.00 sec)

mysql>
Once you have your strings converted to real dates, you can use the builtin date handling functions.

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
December 15, 2017 03:32PM
Re: question about the date
December 15, 2017 04:58PM


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.