Trying to convert time from 1530 into 3:30 PM time format in SQL server. Times = 1530
I have tried:
convert(time,LEFT(Times,2)+':'+right(Times,2))
Results: 15:30:00.0000000
But it is in 24 Hrs, I want to convert into 3:30 PM. And Remove seconds. Any ideas?
Thanks in advance.
try this:
SET @Times ='1530'
select CONVERT(varchar(15),CAST(CONVERT(datetime,LEFT(@Times,2)+':'+right(@Times,2)) AS TIME),100)