INSERT INTO covernote (issue_date) VALUES ( STR_TO_DATE ( '13-May-13','%Y-%m-%d') );
Asked
Active
Viewed 17 times
-2
-
1Because May is not %m see https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format – P.Salmon Mar 02 '21 at 07:24
2 Answers
2
Because May is not %m see https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format - %b for abbreviated month or %M for full month name
+--------------------------------------+--------------------------------------+--------------------------------------+
| STR_TO_DATE( '13-May-13','%Y-%m-%d') | STR_TO_DATE( '13-May-13','%Y-%b-%d') | STR_TO_DATE( '13-May-13','%Y-%M-%d') |
+--------------------------------------+--------------------------------------+--------------------------------------+
| NULL | 2013-05-13 | 2013-05-13 |
+--------------------------------------+--------------------------------------+--------------------------------------+
1 row in set, 1 warning (0.106 sec)
It's a pity you picked may as a representative sample..
![](../../users/profiles/6152400.webp)
P.Salmon
- 14,173
- 2
- 10
- 18
1
Per the documentation on date formatting, %m
is the code for "Month, numeric (00..12)".
You are looking for %M
, which represents "Month name (January..December)"
![](../../users/profiles/15299500.webp)
samuei
- 688
- 2
- 14