I have a date stored for a weekly metric in a legacy database as a string with this format:
2010 10
which was crafter with the %Y %U
format (i.e years followed by week number)
So I try to reverse it into a datetime column by doing STR_TO_DATE(time_week, '%Y %U')
but it does not seem to understand the week format
when I do a test on hardcoded strings, it does not work too
mysql> select str_to_date('2015 01', '%Y %U');
+---------------------------------+
| str_to_date('2015 01', '%Y %U') |
+---------------------------------+
| 2015-00-00 |
+---------------------------------+
mysql> select str_to_date('2015 20', '%Y %U');
+---------------------------------+
| str_to_date('2015 20', '%Y %U') |
+---------------------------------+
| 2015-00-00 |
+---------------------------------+
I'm certainly missing the elephant in the room but I cant' see what.