19
Answers

Time format

nishant ranjan

nishant ranjan

12y
2k
1
select left(convert(varchar, online_time,109),4)+' '+ right(convert(varchar, online_time,109),2) as online_time from time


above is my query

i want output as
04:30 am  4:30 am will do(if initial 0 is removed no prob)
09:45 pm
11:15 am

my prob is that above query is giving right output for time before 10 am/pm but after 9:59 am/pm time is wrong i.e, it displays

11:3 pm instead of 11:30 pm
and give right for
4:40 pm

how i can do that


 

Answers (19)