The MySQL manual for str_to_date states:
If str contains an illegal date, time, or datetime value,
STR_TO_DATE() returns NULL. An
illegal value also produces a warning.
Surely "I'm_not_a_valid_date" is not a valid date, time or
datetime value.
mysql> select str_to_date("I'm_not_a_valid_date","I'm_not_a_valid_date"); +------------------------------------------------------------+ | str_to_date("I'm_not_a_valid_date","I'm_not_a_valid_date") | +------------------------------------------------------------+ | 0000-00-00 | +------------------------------------------------------------+ 1 row in set (0.00 sec)
The problem here is that values in the format string which are
not preceded by the percent sign (%) are treated as constant
characters which must match the input string exactly. Normally
these characters are used as delimiters. For example, …