Skip to content Skip to sidebar Skip to footer

Sql Format Time Object From 24 Hour To 12

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

Solution 1:

Try using this:

DECLARE @aux NVARCHAR(8)='16:45:00'
SELECT CONVERT(VARCHAR(15),CAST(@aux AS TIME),100)

Post a Comment for "Sql Format Time Object From 24 Hour To 12"