Mega Code Archive

 
Categories / MySQL / String
 

The CONVERT() function allows you to convert dates in the same way as the CAST() function

mysql> CONVERT(<expression>, <type>) mysql> mysql> SELECT CONVERT(20041031, DATE); +-------------------------+ | CONVERT(20041031, DATE) | +-------------------------+ | 2004-10-31              | +-------------------------+ 1 row in set (0.00 sec) mysql>