Convert to Datetime MM/dd/yyyy HH:mm:ss in Sql Server

前端 未结 4 828
南方客
南方客 2021-02-19 00:57

How to convert given date format to MM/dd/yyyy HH:mm:ss

I tried this one below but not achieved. Can anyone help me?

SELECT CONVERT(VARCHAR(         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 01:39

    use

    select convert(varchar(10),GETDATE(), 103) + 
           ' '+
           right(convert(varchar(32),GETDATE(),108),8) AS Date_Time
    

    It will Produce:

    Date_Time 30/03/2015 11:51:40

提交回复
热议问题