Converts a value into the DATE data type format.
SELECT CONVERT(“2017-08-29”, DATE); |
The CONVERT() function transforms a value into a designated datatype or character set.
Tip: For analogous conversions, explore the CAST() function.
CONVERT(value, type) |
OR:
CONVERT(value USING charset) |
Parameter |
Description |
||||||||||||||||||||
value |
Required: The value that will undergo conversion |
||||||||||||||||||||
type |
Required: The target datatype for conversion, which can be any of the following:
|
||||||||||||||||||||
charset |
Required: The character set to which the conversion is applied |
Works in: |
From MySQL version 4.0 |
Converts a value into the CHAR data type.
SELECT CONVERT(150, CHAR); |
Converts a value into the TIME data type.
SELECT CONVERT(“14:06:10”, TIME); |
Converts a value into the LATIN1 character set.
SELECT CONVERT(“W3Schools.com” USING latin1); |