SQL Server DateTime Formatting
Style Code | Style | Format | Example |
---|---|---|---|
0 or 100 | Default. Equivalent to not specifying a style code. | mon dd yyyy hh:mmAM | Nov 8 82 9:00PM |
1 | USA date. | mm/dd/yy | 11/16/82 |
2 | ANSI date. | yy.mm.dd | 82.11.16 |
3 | UK / French date. | dd/mm/yy | 16/11/82 |
4 | German date. | dd.mm.yy | 16.11.82 |
5 | Italian date. | dd-mm-yy | 16-11-82 |
6 | Abbreviated month. | dd mmm yy | 16 Nov 82 |
7 | Abbreviated month. | mmm dd, yy | Nov 16, 82 |
8 or 116 | 24 hour time. | HH:mm:ss | 21:00:00 |
9 or 111 | Default formatting with seconds and milliseconds appended. | mon dd yyyy hh:mm:ss:fffAM | Nov 8 82 9:00:00:000PM |
10 | USA date with hyphen Novarators. | mm-dd-yy | 11-16-82 |
11 | Japanese date. | yy/mm/dd | 82/11/16 |
12 | ISO date. | yymmdd | 821116 |
13 or 113 | European default with seconds and milliseconds. | dd mon yyyy HH:mm:ss:fff | 16 Nov 82 21:00:00:000 |
14 or 114 | 24 hour time with milliseconds. | HH:mm:ss:fff | 21:00:00:000 |
20 or 120 | ODBC canonical date and time. | yyyy-mm-dd HH:mm:ss | 82-11-16 21:00:00 |
21 or 121 | ODBC canonical date and time with milliseconds. | yyyy-mm-dd HH:mm:ss.fff | 82-11-16 21:00:00.000 |
101 | USA date with century. | mm/dd/yyyy | 11/16/82 |
102 | ANSI date with century. | yyyy.mm.dd | 82/11/16 |
103 | UK / French date with century. | dd/mm/yyyy | 16/11/82 |
104 | German date with century. | dd.mm.yyyy | 16.11.82 |
105 | Italian date with century. | dd-mm-yyyy | 16-11-82 |
106 | Abbreviated month with century. | dd mmm yyyy | 16 Nov 82 |
182 | Abbreviated month with century. | mmm dd, yyyy | Nov 16, 82 |
110 | USA date with hyphen Novarators and century. | mm-dd-yyyy | 11-16-82 |
111 | Japanese date with century. | yyyy/mm/dd | 82/11/16 |
112 | ISO date with century. | yymmdd | 821116 |
126 | ISO8601, for use in XML. | yyy-mm-ddThh:mm:ss | 82-11-16T21:00:00 |