SQL SERVER时间格式化
1 declare @i int=1 2 begin 3 while(@i<=200) 4 begin 5 BEGIN try 6 print convert(varchar(3),@i)+' '+convert(VARCHAR,getdate(),@i) 7 END TRY 8 BEGIN catch 9 end catch 10 set @i=@i+1 11 end 12 end
结果:
1:11/30/14
2:14.11.30
3:30/11/14
4:30.11.14
5:30-11-14
6:30 11 14
7:11 30, 14
8:21:18:44
9:11 30 2014 9:18:44:983PM
10:11-30-14
11:14/11/30
12:141130
13:30 11 2014 21:18:44:983
14:21:18:44:983
20:2014-11-30 21:18:44
21:2014-11-30 21:18:44.983
22:11/30/14 9:18:44 PM
23:2014-11-30
24:21:18:44
25:2014-11-30 21:18:44.983
100:11 30 2014 9:18PM
101:11/30/2014
102:2014.11.30
103:30/11/2014
104:30.11.2014
105:30-11-2014
106:30 11 2014
107:11 30, 2014
108:21:18:44
109:11 30 2014 9:18:44:983PM
110:11-30-2014
111:2014/11/30
112:20141130
113:30 11 2014 21:18:44:983
114:21:18:44:983
120:2014-11-30 21:18:44
121:2014-11-30 21:18:44.983
126:2014-11-30T21:18:44.983
127:2014-11-30T21:18:45.030
130: 8 ??? 1436 9:18:45:030PM
131: 8/02/1436 9:18:45:030PM