--SQL CONVERT日期转换
print GETDATE() --相同
Select CONVERT(varchar(100), GETDATE(), 0) AS NDateTime --: 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 100) AS NDateTime --: 05 16 2006 10:57AM --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 1) AS NDateTime --: 05/16/06
Select CONVERT(varchar(100), GETDATE(), 101) AS NDateTime --: 05/16/2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 2) AS NDateTime --: 06.05.16
Select CONVERT(varchar(100), GETDATE(), 102) AS NDateTime --: 2006.05.16 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 3) AS NDateTime --: 16/05/06
Select CONVERT(varchar(100), GETDATE(), 103) AS NDateTime --: 16/05/2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 4) AS NDateTime --: 16.05.06
Select CONVERT(varchar(100), GETDATE(), 104) AS NDateTime --: 16.05.2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 5) AS NDateTime --: 16-05-06
Select CONVERT(varchar(100), GETDATE(), 105) AS NDateTime --: 16-05-2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 6) AS NDateTime --: 16 05 06
Select CONVERT(varchar(100), GETDATE(), 106) AS NDateTime --: 16 05 2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 7) AS NDateTime --: 05 16, 06
Select CONVERT(varchar(100), GETDATE(), 107) AS NDateTime --: 05 16, 2006 --相同
Select CONVERT(varchar(100), GETDATE(), 8) AS NDateTime --: 10:57:46
Select CONVERT(varchar(100), GETDATE(), 108) AS NDateTime --: 10:57:49
Select CONVERT(varchar(100), GETDATE(), 24) AS NDateTime --: 10:57:47 --相同
Select CONVERT(varchar(100), GETDATE(), 9) AS NDateTime --: 05 16 2006 10:57:46:827AM
Select CONVERT(varchar(100), GETDATE(), 109) AS NDateTime --: 05 16 2006 10:57:49:437AM --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 10) AS NDateTime --: 05-16-06
Select CONVERT(varchar(100), GETDATE(), 110) AS NDateTime --: 05-16-2006 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 11) AS NDateTime --: 06/05/16
Select CONVERT(varchar(100), GETDATE(), 111) AS NDateTime --: 2006/05/16 --年份2或者4位
Select CONVERT(varchar(100), GETDATE(), 12) AS NDateTime --: 060516
Select CONVERT(varchar(100), GETDATE(), 112) AS NDateTime --: 20060516 --相同
Select CONVERT(varchar(100), GETDATE(), 13) AS NDateTime --: 16 05 2006 10:57:46:937
Select CONVERT(varchar(100), GETDATE(), 113) AS NDateTime --: 16 05 2006 10:57:49:513 --相同
Select CONVERT(varchar(100), GETDATE(), 14) AS NDateTime --: 10:57:46:967
Select CONVERT(varchar(100), GETDATE(), 114) AS NDateTime --: 10:57:49:547 --相同
Select CONVERT(varchar(100), GETDATE(), 20) AS NDateTime --: 2006-05-16 10:57:47
Select CONVERT(varchar(100), GETDATE(), 120) AS NDateTime --: 2006-05-16 10:57:49 --相同
Select CONVERT(varchar(100), GETDATE(), 21) AS NDateTime --: 2006-05-16 10:57:47.157
Select CONVERT(varchar(100), GETDATE(), 121) AS NDateTime --: 2006-05-16 10:57:49.700
Select CONVERT(varchar(100), GETDATE(), 25) AS NDateTime --: 2006-05-16 10:57:47.250
--相似
Select CONVERT(varchar(100), GETDATE(), 126) AS NDateTime --: 2006-05-16T10:57:49.827 Select CONVERT(varchar(100), GETDATE(), 22) AS NDateTime --: 05/16/06 10:57:47 AM --常用
Select CONVERT(varchar(100), GETDATE(), 23) AS NDateTime --: 2006-05-16 Select CONVERT(varchar(100), GETDATE(), 130) AS NDateTime --: 18 ???? ?????? 1427 10:57:49:907AM
Select CONVERT(varchar(100), GETDATE(), 131) AS NDateTime --: 18/04/1427 10:57:49:920AM