반응형
DATE ONLY FORMATS
1 | convert(varchar, getdate(), 1) | mm/dd/yy | 12/30/06 |
2 | convert(varchar, getdate(), 2) | yy.mm.dd | 06.12.30 |
3 | convert(varchar, getdate(), 3) | dd/mm/yy | 30/12/06 |
4 | convert(varchar, getdate(), 4) | dd.mm.yy | 30.12.06 |
5 | convert(varchar, getdate(), 5) | dd-mm-yy | 30-12-06 |
6 | convert(varchar, getdate(), 6) | dd-Mon-yy | 30 Dec 06 |
7 | convert(varchar, getdate(), 7) | Mon dd, yy | Dec 30, 06 |
10 | convert(varchar, getdate(), 10) | mm-dd-yy | 12-30-06 |
11 | convert(varchar, getdate(), 11) | yy/mm/dd | 06/12/30 |
12 | convert(varchar, getdate(), 12) | yymmdd | 061230 |
23 | convert(varchar, getdate(), 23) | yyyy-mm-dd | 2006-12-30 |
101 | convert(varchar, getdate(), 101) | mm/dd/yyyy | 12/30/2006 |
102 | convert(varchar, getdate(), 102) | yyyy.mm.dd | 2006.12.30 |
103 | convert(varchar, getdate(), 103) | dd/mm/yyyy | 30/12/2006 |
104 | convert(varchar, getdate(), 104) | dd.mm.yyyy | 30.12.2006 |
105 | convert(varchar, getdate(), 105) | dd-mm-yyyy | 30-12-2006 |
106 | convert(varchar, getdate(), 106) | dd Mon yyyy | 30 Dec 2006 |
107 | convert(varchar, getdate(), 107) | Mon dd, yyyy | Dec 30, 2006 |
110 | convert(varchar, getdate(), 110) | mm-dd-yyyy | 12-30-2006 |
111 | convert(varchar, getdate(), 111) | yyyy/mm/dd | 2006/12/30 |
112 | convert(varchar, getdate(), 112) | yyyymmdd | 20061230 |
TIME ONLY FORMATS
8 | convert(varchar, getdate(), 8) | hh:mm:ss | 00:38:54 |
14 | convert(varchar, getdate(), 14) | hh:mm:ss:nnn | 00:38:54:840 |
24 | convert(varchar, getdate(), 24) | hh:mm:ss | 00:38:54 |
108 | convert(varchar, getdate(), 108) | hh:mm:ss | 00:38:54 |
114 | convert(varchar, getdate(), 114) | hh:mm:ss:nnn | 00:38:54:840 |
DATE & TIME FORMATS
0 | convert(varchar, getdate(), 0) | Mon dd yyyy hh:mm AM/PM | Dec 30 2006 12:38AM |
9 | convert(varchar, getdate(), 9) | Mon dd yyyy hh:mm:ss:nnn AM/PM | Dec 30 2006 12:38:54:840AM |
13 | convert(varchar, getdate(), 13) | dd Mon yyyy hh:mm:ss:nnn AM/PM | 30 Dec 2006 00:38:54:840AM |
20 | convert(varchar, getdate(), 20) | yyyy-mm-dd hh:mm:ss | 2006-12-30 00:38:54 |
21 | convert(varchar, getdate(), 21) | yyyy-mm-dd hh:mm:ss:nnn | 2006-12-30 00:38:54.840 |
22 | convert(varchar, getdate(), 22) | mm/dd/yy hh:mm:ss AM/PM | 12/30/06 12:38:54 AM |
25 | convert(varchar, getdate(), 25) | yyyy-mm-dd hh:mm:ss:nnn | 2006-12-30 00:38:54.840 |
100 | convert(varchar, getdate(), 100) | Mon dd yyyy hh:mm AM/PM | Dec 30 2006 12:38AM |
109 | convert(varchar, getdate(), 109) | Mon dd yyyy hh:mm:ss:nnn AM/PM | Dec 30 2006 12:38:54:840AM |
113 | convert(varchar, getdate(), 113) | dd Mon yyyy hh:mm:ss:nnn | 30 Dec 2006 00:38:54:840 |
120 | convert(varchar, getdate(), 120) | yyyy-mm-dd hh:mm:ss | 2006-12-30 00:38:54 |
121 | convert(varchar, getdate(), 121) | yyyy-mm-dd hh:mm:ss:nnn | 2006-12-30 00:38:54.840 |
126 | convert(varchar, getdate(), 126) | yyyy-mm-dd T hh:mm:ss:nnn | 2006-12-30T00:38:54.840 |
127 | convert(varchar, getdate(), 127) | yyyy-mm-dd T hh:mm:ss:nnn | 2006-12-30T00:38:54.840 |
출처 : https://www.mssqltips.com/sqlservertip/1145/date-and-time-conversions-using-sql-server/
728x90
반응형
'Database ( DB ) > Database' 카테고리의 다른 글
[MSSQL] IDENTITY 값 초기화 하는 방법 (0) | 2021.08.08 |
---|---|
Oracle 12c Download 방법 (0) | 2021.06.14 |
java - write to file (0) | 2021.05.16 |
DBMS별 함수 비교 (0) | 2021.05.16 |
[MySQL] 문자열 길이 가져오기(length, char_length 함수) (0) | 2021.05.16 |