Time | AM/PM |
3.49 | PM |
10.15 | AM |
10.09 | PM |
12.00 | PM |
12.00 | AM |
9.00 | AM |
5.15 | PM |
Hi, I'm trying to work out how to convert 12 hour time to 24 hour time. Apologies if this has been answered before but i couldn't find one in it's basic form like this.
I saw someone else came up with this
IF [AM/PM] = 'PM' && Left([Time of Usage],2)!='12'
THEN DateTimeAdd('1970-01-01 ' + [Time of Usage], 12, 'hours')
ELSE [Time of Usage]
ENDIF
But since the columns here are only Time and AM/PM I changed it to
IF [AM/PM] = 'PM' && Left([Time],2)!='12'
THEN [Time], 12, 'hours')
ELSE [Time]
ENDIF
Is that at all correct?
But then I also thought that because noon is PM and midnight is AM, they would turn out 2400, 1200 respectively. I'm not sure how to account for that.
Hi @saltysnax
You can use this function.
DateTimeParse(Replace(ToString([Time],2),".",":") + " " +[AM/PM],"%I:%M %P")
thank you, apologies but very new to this. is that output for python?
No. This is made by Formula tool.
Please refer the uploaded workflow.