Need a way (T-SQL) to convert military time to a standard time format.
1338= 01:38:00 PM
1112= 11:12:00 AM
1135= 11:35:00 AM
1149= 11:49:00 PM
2014= 08:14:00 PM
22:35= 10:35:00 PM
I've tried this so far from an earlier thread but I'm having a little trouble; any help would do
select mycol, Right(Convert(VarChar(30),
Convert(DateTime, Stuff(Stuff(Right(Replicate('0', 6) + Convert(VarChar(8), mycol), 6), 3,0, ':'), 6, 0, ':')), 100), 7) as timevalues from miltarytbl
1338= 01:38:00 PM
1112= 11:12:00 AM
1135= 11:35:00 AM
1149= 11:49:00 PM
2014= 08:14:00 PM
22:35= 10:35:00 PM
I've tried this so far from an earlier thread but I'm having a little trouble; any help would do
select mycol, Right(Convert(VarChar(30),
Convert(DateTime, Stuff(Stuff(Right(Replicate('0', 6) + Convert(VarChar(8), mycol), 6), 3,0, ':'), 6, 0, ':')), 100), 7) as timevalues from miltarytbl