This is the query I am using:
SELECT
CONVERT(varchar(15), CAST('08:00:00.0000000' AS TIME), 100)
And I get this output: 8:00AM
I want the output to be this: 08:00AM (two digit hours)
How can I get this output?
CodePudding user response:
SELECT FORMAT(start_time,'hh:mm tt') AS start_time
FROM table_name
CodePudding user response:
Sql Server way of LPAD
select right('0' CONVERT(varchar(15),CAST('08:00:00.0000000' AS TIME),100), 7)
