Converting military time to readable text
I followed a previous forum thread detailing a calcuation to convert military time to text. It works great... but only if you're at the top of an hour. In other words, the hours convert just fine, as does the am/pm. However the minutes won't work at all. If your minutes fall between :01 and :59 the resulting minutes are alway :00. I will include the formula below in hopes that someone can help me figure out how to get my military time to read 3:14 pm instead of 3:00 pm. Any help is greatly appreciated.
Let ( [ theData= militaryTime ; theHour= Left ( theData ; 2 ) ; theMinute= Right ( theData ; 2 ) ; theSeconds= "00" ; theTime= Time ( theHour ; theMinute ; theSeconds ) ; theResultingHours= Hour ( theTime ) ; theResultingMinutes= Minute ( theTime ) ; theSuffix= Case ( theResultingHours ≥ 12 ; " pm" ; " am" ) ; theFInalHours = Mod ( theResultingHours - 1 ; 12 ) + 1 ; theFinalMinutes= Right ( "00" & theResultingMinutes ; 2 ) ; result= theFinalHours & ":" & theFinalMinutes & theSuffix ]; result )