Created
August 10, 2016 07:43
-
-
Save lefred/1343bc190ba3de58c4e484fac4ff34b3 to your computer and use it in GitHub Desktop.
STR_TO_DATE MySQL 5.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql2 mysql> select str_to_date('9','%m'); | |
+-----------------------+ | |
| str_to_date('9','%m') | | |
+-----------------------+ | |
| NULL | | |
+-----------------------+ | |
1 row in set, 1 warning (0.00 sec) | |
mysql2 mysql> show variables like 'sql_mode'\G | |
*************************** 1. row *************************** | |
Variable_name: sql_mode | |
Value: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | |
1 row in set (0.00 sec) | |
mysql2 mysql> set sql_mode=''; | |
Query OK, 0 rows affected, 1 warning (0.00 sec) | |
mysql2 mysql> select str_to_date('9','%m'); | |
+-----------------------+ | |
| str_to_date('9','%m') | | |
+-----------------------+ | |
| 0000-09-00 | | |
+-----------------------+ | |
1 row in set (0.00 sec) | |
Check the manual: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment