SQL Format Time Object From 24 Hour to 12

后端 未结 1 1817
不思量自难忘°
不思量自难忘° 2021-01-21 11:30

Is there a way to convert a time object to a 12 hour format in SQL? I can\'t nessessarilly use datetime because the data being retrieved is not specific for dates.

16:45

相关标签:
1条回答
  • 2021-01-21 11:55

    Try using this:

    DECLARE @aux NVARCHAR(8)='16:45:00'
    SELECT CONVERT(VARCHAR(15),CAST(@aux AS TIME),100)
    
    0 讨论(0)
提交回复
热议问题