CONVERT string to datetime

Use the CONVERT function to convert a string to a specific datetime style. The first parameter is the string datatype and size, such as varchar(20). The second parameter is a datetime expression. The third parameter is the date_style, or the style number. Style numbers are defined by Microsoft SQL Server. Date expressions are not supported. Date time styles 130 and 131 are not supported.

Syntax

CONVERT(string_type, datetime_expression, date_style)