SQL Server 日期格式

來源:互聯網
上載者:User

輸入:

declare @a intset @a = 0while @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+1end

 

輸出:

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

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.