首页 > 开发 > 综合 > 正文

SQL 2008R2 日期转换

2024-07-21 02:50:36
字体:
来源:转载
供稿:网友
SQL 2008R2 日期转换
--SQL CONVERT日期转换PRint GETDATE()--相同Select CONVERT(varchar(100), GETDATE(), 0) AS NDateTime   --: 05 16 2006 10:57AMSelect CONVERT(varchar(100), GETDATE(), 100) AS NDateTime --: 05 16 2006 10:57AM--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 1) AS NDateTime   --: 05/16/06Select CONVERT(varchar(100), GETDATE(), 101) AS NDateTime --: 05/16/2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 2) AS NDateTime   --: 06.05.16Select CONVERT(varchar(100), GETDATE(), 102) AS NDateTime --: 2006.05.16--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 3) AS NDateTime   --: 16/05/06Select CONVERT(varchar(100), GETDATE(), 103) AS NDateTime --: 16/05/2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 4) AS NDateTime   --: 16.05.06Select CONVERT(varchar(100), GETDATE(), 104) AS NDateTime --: 16.05.2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 5) AS NDateTime   --: 16-05-06Select CONVERT(varchar(100), GETDATE(), 105) AS NDateTime --: 16-05-2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 6) AS NDateTime   --: 16 05 06Select CONVERT(varchar(100), GETDATE(), 106) AS NDateTime --: 16 05 2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 7) AS NDateTime   --: 05 16, 06Select CONVERT(varchar(100), GETDATE(), 107) AS NDateTime --: 05 16, 2006--相同Select CONVERT(varchar(100), GETDATE(), 8) AS NDateTime   --: 10:57:46Select CONVERT(varchar(100), GETDATE(), 108) AS NDateTime --: 10:57:49Select CONVERT(varchar(100), GETDATE(), 24) AS NDateTime  --: 10:57:47--相同Select CONVERT(varchar(100), GETDATE(), 9) AS NDateTime   --: 05 16 2006 10:57:46:827AMSelect 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-06Select CONVERT(varchar(100), GETDATE(), 110) AS NDateTime --: 05-16-2006--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 11) AS NDateTime  --: 06/05/16Select CONVERT(varchar(100), GETDATE(), 111) AS NDateTime --: 2006/05/16--年份2或者4位Select CONVERT(varchar(100), GETDATE(), 12) AS NDateTime  --: 060516Select CONVERT(varchar(100), GETDATE(), 112) AS NDateTime --: 20060516--相同Select CONVERT(varchar(100), GETDATE(), 13) AS NDateTime  --: 16 05 2006 10:57:46:937Select 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:967Select CONVERT(varchar(100), GETDATE(), 114) AS NDateTime --: 10:57:49:547--相同Select CONVERT(varchar(100), GETDATE(), 20) AS NDateTime  --: 2006-05-16 10:57:47Select 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.157Select CONVERT(varchar(100), GETDATE(), 121) AS NDateTime --: 2006-05-16 10:57:49.700Select 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.827Select CONVERT(varchar(100), GETDATE(), 22) AS NDateTime  --: 05/16/06 10:57:47 AM--常用Select CONVERT(varchar(100), GETDATE(), 23) AS NDateTime  --: 2006-05-16Select CONVERT(varchar(100), GETDATE(), 130) AS NDateTime --: 18 ???? ?????? 1427 10:57:49:907AMSelect CONVERT(varchar(100), GETDATE(), 131) AS NDateTime --: 18/04/1427 10:57:49:920AM

  


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表