R
Robert Crandal
I would like to hear everyone's techniques for converting
a string into military time format ONLY if the string resembles
a standard time format.
For example,
"12:00am" --> "0000"
"8:45 pm" --> "1945"
"1:22 PM" --> "1322"
"3 : 36 p m --> "1546"
"2:00" --> "0200" [special case]
"hello" --> "0000" [special case]
In the special cases where a user forgets to
type "am", "AM", "pm", or "PM", I will want to
covert as shown above (morning military time).
If the string does not resemble a standard time
format, then we can just convert that to "0000" hours.
a string into military time format ONLY if the string resembles
a standard time format.
For example,
"12:00am" --> "0000"
"8:45 pm" --> "1945"
"1:22 PM" --> "1322"
"3 : 36 p m --> "1546"
"2:00" --> "0200" [special case]
"hello" --> "0000" [special case]
In the special cases where a user forgets to
type "am", "AM", "pm", or "PM", I will want to
covert as shown above (morning military time).
If the string does not resemble a standard time
format, then we can just convert that to "0000" hours.