DATE
checks the validity while str_to_date
does not.
mysql> select str_to_date('2010-02-31', '%Y-%m-%d');
+---------------------------------------+
| str_to_date('2010-02-31', '%Y-%m-%d') |
+---------------------------------------+
| 2010-02-31 |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> select str_to_date('2010-04-31', '%Y-%m-%d');
+---------------------------------------+
| str_to_date('2010-04-31', '%Y-%m-%d') |
+---------------------------------------+
| 2010-04-31 |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> select date('2010-02-31');
+--------------------+
| date('2010-02-31') |
+--------------------+
| NULL |
+--------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select date('2010-04-31');
+--------------------+
| date('2010-04-31') |
+--------------------+
| NULL |
+--------------------+
1 row in set, 1 warning (0.00 sec)
UPDATE according to @Aziz , DATE
will check whether a date is real or not. According to my test, seems str_to_date
does not check.