SQL获取日期格式

SELECT CONVERT(VARCHAR, GetDate(), 101) + ' ' + 
          CONVERT(VARCHAR, DATEPART(hh, GetDate())) + ':' + 
          RIGHT('0' + CONVERT(VARCHAR, DATEPART(mi, GetDate())), 2) AS Date
          
          SELECT CONVERT(CHAR(11),GETDATE(),101)
     + CONVERT(CHAR( 5),GETDATE(),114)
     
     
Select Cast(convert(varchar(16),Getdate(),120) as DateTime) as [Date]

Select convert(varchar(16),Getdate(),120) as [Date]

 

posted @ 2014-03-14 16:17  EasyPass  阅读(475)  评论(0编辑  收藏  举报