Converting Time to 24 Hours

I’m trying to convert 12 hr clock to 24 hr clock value as a System.String, I’ve got the desired outcome but it is far from efficient, can anyone offer a more streamline approach?
Cheers KS
210524-ConvertingTimeTo24Hrs.dyn (78.7 KB)

@Kai Try doing it the Python way?


from datetime import datetime
OUT = []
for time in IN[0]:
	x = datetime.strptime(time, "%I:%M:%S %p")
	OUT.append(datetime.strftime(x, "%H%MH"))

Brilliant… thanks @AmolShah that works very well.

1 Like