2

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:00 --> 4:45 PM

Ghost
  • 2,146
  • 19
  • 21
Quinson
  • 95
  • 1
  • 7

1 Answers1

2

Try using this:

DECLARE @aux NVARCHAR(8)='16:45:00'
SELECT CONVERT(VARCHAR(15),CAST(@aux AS TIME),100)
Yaroslav
  • 6,476
  • 10
  • 48
  • 89