The CONVERT() function allows you to convert dates in the same way as the CAST() function : CONVERT « String « SQL / MySQL






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>

   
    
    
    
    
  








Related examples in the same category

1.What CONVERT actually works can be seen by transforming the character string into hexadecimal representation:
2.Use CONVERT to copy data from one column of a table into another and change the character set.