Convert Integer value into Hour value (AM / PM) in SQL Server -
i have table hour values. need convert hour value am/pm format, shown here:
val hour --------------- 9 9:00 19 7:00 pm 10 10:00 19 7:00 pm 14 2:00 pm i have tried logic:
declare @timing varchar(5)='15:02' declare @time time=cast(@timing time) select convert(varchar(50),@time, 100) but requires val converted varchar. there other way or inbuilt function available in sql server this?
select format(dateadd(hh,val,'00:00:00'),'hh:mm tt') yourtable
Comments
Post a Comment