CONVERT

CONVERT#

Converts a value from one data type to another. CONVERT is the SQL Server–specific conversion function and additionally accepts a style that controls how dates, times and numbers are formatted.

Syntax#

CONVERT ( data_type [ ( length ) ], expression [ , style ] )

Examples#

SELECT CONVERT(date, '2017-05-04');
SELECT CONVERT(varchar(20), GETDATE(), 120);

See Also#