select convert(char(100),GetDate(),120) as Date
第3个参数就是用来设置日期类型数据的显示样式的,下面介绍几种样式的参数
SELECT CONVERT(varchar(100), GETDATE(), 0) 05 9 2011 9:12AM
SELECT CONVERT(varchar(100), GETDATE(), 1) 05/09/11
SELECT CONVERT(varchar(100), GETDATE(), 2) 11.05.09
SELECT CONVERT(varchar(100), GETDATE(), 3) 09/05/11
SELECT CONVERT(varchar(100), GETDATE(), 4) 09.05.11
SELECT CONVERT(varchar(100), GETDATE(), 5) 09-05-11
SELECT CONVERT(varchar(100), GETDATE(), 6) 09 05 11
SELECT CONVERT(varchar(100), GETDATE(), 7) 05 09, 11
SELECT CONVERT(varchar(100), GETDATE(), 8) 09:13:14
SELECT CONVERT(varchar(100), GETDATE(), 9) 05 9 2011 9:13:14:670AM
SELECT CONVERT(varchar(100), GETDATE(), 10) 05-09-11
SELECT CONVERT(varchar(100), GETDATE(), 11) 11/05/09
SELECT CONVERT(varchar(100), GETDATE(), 12) 110509
SELECT CONVERT(varchar(100), GETDATE(), 13) 09 05 2011 09:13:14:670
SELECT CONVERT(varchar(100), GETDATE(), 14) 09:13:14:670
SELECT CONVERT(varchar(100), GETDATE(), 20) 2011-05-09 09:13:14
SELECT CONVERT(varchar(100), GETDATE(), 21) 2011-05-09 09:13:14.670
SELECT CONVERT(varchar(100), GETDATE(), 22) 05/09/11 9:15:33 AM
SELECT CONVERT(varchar(100), GETDATE(), 23) 2011-05-09
SELECT CONVERT(varchar(100), GETDATE(), 24) 09:15:33
SELECT CONVERT(varchar(100), GETDATE(), 25) 2011-05-09 09:15:33.140
SELECT CONVERT(varchar(100), GETDATE(), 100) 05 9 2011 9:15AM
SELECT CONVERT(varchar(100), GETDATE(), 101) 05/09/2011
SELECT CONVERT(varchar(100), GETDATE(), 102) 2011.05.09
SELECT CONVERT(varchar(100), GETDATE(), 103) 09/05/2011
SELECT CONVERT(varchar(100), GETDATE(), 104) 09.05.2011
SELECT CONVERT(varchar(100), GETDATE(), 105) 09-05-2011
SELECT CONVERT(varchar(100), GETDATE(), 106) 09 05 2011
SELECT CONVERT(varchar(100), GETDATE(), 107) 05 09, 2011
SELECT CONVERT(varchar(100), GETDATE(), 108) 09:16:38
SELECT CONVERT(varchar(100), GETDATE(), 109) 05 9 2011 9:16:38:543AM
SELECT CONVERT(varchar(100), GETDATE(), 110) 05-09-2011
SELECT CONVERT(varchar(100), GETDATE(), 111) 2011/05/09
SELECT CONVERT(varchar(100), GETDATE(), 112) 20110509
SELECT CONVERT(varchar(100), GETDATE(), 113) 09 05 2011 09:17:19:857
SELECT CONVERT(varchar(100), GETDATE(), 114) 09:17:19:857
SELECT CONVERT(varchar(100), GETDATE(), 120) 2011-05-09 09:17:19
SELECT CONVERT(varchar(100), GETDATE(), 121) 2011-05-09 09:17:19.857
SELECT CONVERT(varchar(100), GETDATE(), 126) 2011-05-09T09:17:19.857
SELECT CONVERT(varchar(100), GETDATE(), 130) 10 ??? 1440 9:53:49:903AMSELECT CONVERT(varchar(100), GETDATE(), 131) 6/06/1432 9:17:19:857AM