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]

 

你可能感兴趣的:(日期格式)