SQL Server 日期格式

输入:

declare @a int
set @a = 0
while @a<=10000 
begin
    begin try
    print 'Convert(varchar,Getdate(),' + cast(@a as varchar) + ') -> ' + Convert(varchar, Getdate() , cast(@a as int))
    end try
    begin catch
    --print cast(@a as varchar) + ': Error'
    end catch
    set @a = @a+1
end

 

输出:

Convert(varchar,Getdate(),0) -> 06 14 2013  2:53PM
Convert(varchar,Getdate(),1) -> 06/14/13
Convert(varchar,Getdate(),2) -> 13.06.14
Convert(varchar,Getdate(),3) -> 14/06/13
Convert(varchar,Getdate(),4) -> 14.06.13
Convert(varchar,Getdate(),5) -> 14-06-13
Convert(varchar,Getdate(),6) -> 14 06 13
Convert(varchar,Getdate(),7) -> 06 14, 13
Convert(varchar,Getdate(),8) -> 14:53:16
Convert(varchar,Getdate(),9) -> 06 14 2013  2:53:16:167PM
Convert(varchar,Getdate(),10) -> 06-14-13
Convert(varchar,Getdate(),11) -> 13/06/14
Convert(varchar,Getdate(),12) -> 130614
Convert(varchar,Getdate(),13) -> 14 06 2013 14:53:16:167
Convert(varchar,Getdate(),14) -> 14:53:16:167
Convert(varchar,Getdate(),20) -> 2013-06-14 14:53:16
Convert(varchar,Getdate(),21) -> 2013-06-14 14:53:16.167
Convert(varchar,Getdate(),22) -> 06/14/13  2:53:16 PM
Convert(varchar,Getdate(),23) -> 2013-06-14
Convert(varchar,Getdate(),24) -> 14:53:16
Convert(varchar,Getdate(),25) -> 2013-06-14 14:53:16.167
Convert(varchar,Getdate(),100) -> 06 14 2013  2:53PM
Convert(varchar,Getdate(),101) -> 06/14/2013
Convert(varchar,Getdate(),102) -> 2013.06.14
Convert(varchar,Getdate(),103) -> 14/06/2013
Convert(varchar,Getdate(),104) -> 14.06.2013
Convert(varchar,Getdate(),105) -> 14-06-2013
Convert(varchar,Getdate(),106) -> 14 06 2013
Convert(varchar,Getdate(),107) -> 06 14, 2013
Convert(varchar,Getdate(),108) -> 14:53:16
Convert(varchar,Getdate(),109) -> 06 14 2013  2:53:16:170PM
Convert(varchar,Getdate(),110) -> 06-14-2013
Convert(varchar,Getdate(),111) -> 2013/06/14
Convert(varchar,Getdate(),112) -> 20130614
Convert(varchar,Getdate(),113) -> 14 06 2013 14:53:16:190
Convert(varchar,Getdate(),114) -> 14:53:16:190
Convert(varchar,Getdate(),120) -> 2013-06-14 14:53:16
Convert(varchar,Getdate(),121) -> 2013-06-14 14:53:16.190
Convert(varchar,Getdate(),126) -> 2013-06-14T14:53:16.190
Convert(varchar,Getdate(),127) -> 2013-06-14T14:53:16.190
Convert(varchar,Getdate(),130) ->  6 ????? 1434  2:53:16:190PM
Convert(varchar,Getdate(),131) ->  6/08/1434  2:53:16:190PM

 

posted @ 2013-06-14 14:54  suifei  阅读(730)  评论(0编辑  收藏  举报