CONVERT function
Explicitly converts an expression of a data type to another data type.
SQL Server formats the date.
SQL Server supports data formats in Arabian styles using the Kuwaiti algorithm .
In the table, the two columns on the left represent the style values that convert datetime or smalldatetime to character data. Add 100 to the style value to get a four-bit year (yyyy) that includes century digits.
without century digits (yy) |
with century digits (yyyy) |
Standard |
Input/Output * * |
- |
0 or 100 (*) |
Default value |
Mon dd yyyy hh:miam (or PM) |
1 |
101 |
United States |
Mm/dd/yyyy |
2 |
102 |
Ansi |
Yy.mm.dd |
3 |
103 |
UK/France |
Dd/mm/yy |
4 |
104 |
Germany |
Dd.mm.yy |
5 |
105 |
Italy |
Dd-mm-yy |
6 |
106 |
- |
DD Mon yy |
7 |
107 |
- |
Mon dd, yy |
8 |
108 |
- |
Hh:mm:ss |
- |
9 or 109 (*) |
Default value + milliseconds |
Mon dd yyyy hh:mi:ss:mmmAM (or PM) |
10 |
110 |
United States |
Mm-dd-yy |
11 |
111 |
Japan |
Yy/mm/dd |
12 |
112 |
Iso |
Yymmdd |
- |
13 or 113 (*) |
European default + milliseconds |
DD Mon yyyy hh:mm:ss:mmm (24h) |
14 |
114 |
- |
Hh:mi:ss:mmm (24h) |
- |
20 or 120 (*) |
ODBC specification |
yyyy-mm-dd hh:mm:SS[. FFF] |
- |
21 or 121 (*) |
ODBC specification (with milliseconds) |
yyyy-mm-dd hh:mm:SS[. FFF] |
- |
126 (* *) |
ISO8601 |
YYYY-MM-DD Thh:mm:ss:mmm (no spaces included) |
- |
130* |
Kuwait |
DD Mon yyyy hh:mi:ss:mmmAM |
- |
131* |
Kuwait |
Dd/mm/yy Hh:mi:ss:mmmAM |