-
MSSQL Datetime formatsDatabase/MSSQL 2018. 10. 15. 09:17반응형
아래 표에는 없는 형식 변환법 (한국식 날짜 변환)
Select Convert(varchar, getdate(),121) => 2016-04-05 09:28:25.003
Select Convert(varchar(10), getdate(),121) => 2016-04-05
Select Convert(varchar, getdate(), 120) => 2016-04-05 09:28:25
DATE FORMATS Format # Query (current date: 12/30/2006) Sample 1 select convert(varchar, getdate(), 1) 12/30/06 2 select convert(varchar, getdate(), 2) 06.12.30 3 select convert(varchar, getdate(), 3) 30/12/06 4 select convert(varchar, getdate(), 4) 30.12.06 5 select convert(varchar, getdate(), 5) 30-12-06 6 select convert(varchar, getdate(), 6) 30 Dec 06 7 select convert(varchar, getdate(), 7) Dec 30, 06 10 select convert(varchar, getdate(), 10) 12-30-06 11 select convert(varchar, getdate(), 11) 06/12/30 101 select convert(varchar, getdate(), 101) 12/30/2006 102 select convert(varchar, getdate(), 102) 2006.12.30 103 select convert(varchar, getdate(), 103) 30/12/2006 104 select convert(varchar, getdate(), 104) 30.12.2006 105 select convert(varchar, getdate(), 105) 30-12-2006 106 select convert(varchar, getdate(), 106) 30 Dec 2006 107 select convert(varchar, getdate(), 107) Dec 30, 2006 110 select convert(varchar, getdate(), 110) 12-30-2006 111 select convert(varchar, getdate(), 111) 2006/12/30 TIME FORMATS 8 or 108 select convert(varchar, getdate(), 8) 00:38:54 9 or 109 select convert(varchar, getdate(), 9) Dec 30 2006 12:38:54:840AM 14 or 114 select convert(varchar, getdate(), 14) 00:38:54:840 반응형'Database > MSSQL' 카테고리의 다른 글
MSSQL 공백제거 RTRIM, LTRIM (0) 2018.12.14 MSSQL [펌] 성능 향상을 위한 팁 (0) 2018.10.17 MSSQL SELECT와 UPDATE 동시에 하기 (2) 2018.10.02 MSSQL UPDATE with row_number() (0) 2018.09.04 MSSQL 오류 해결 트랜잭션 로그가 꽉 찼습니다. (0) 2018.08.17