Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

military time conversion

Status
Not open for further replies.

ciarra41

Technical User
Sep 11, 2006
116
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top