Parsing time HHH:MM:SS

I have these following columns that I need to parse them as a time

a b c
168:00:00 141:00:00 78:00:00
168:00:00 141:00:00 71:45:11
168:00:00 141:00:00 84:10:14

The time format is HHH:MM:SS

Any idea how to do it ?

Hello @NoobZik,

can you explain it a bit more? What do you expect as output from above values?



Are these perhaps durations as opposed to time stamps? If so you could use the String to Duration node, but you’d need to do a bit of preprocessing first to get the input into a format like 71H 45m 11s beforehand.

What do you want to ultimately do with the data?



What I wanted to do after is calculation ratio between those time something like A/B = x,xx (percentage)
In more detailed manner, I want to calculate the overall equipment effectiveness

Hi @NoobZik , The attached flow contains two flows (of I’m sure many possible options) to get you started. I generally avoid looping, but as you have multiple columns I decided to throw the processing into a column loop on this occassion.

The flows both use regex to split the string into three columns representing H M and S. This could be done using other nodes, such as Cell Splitter, or maybe even String Manipulation or Column Expressions if you want to experience a little more pain! :wink:

The lower flow uses @ScottF’s suggestion that maybe you can do something with Duration by building each into a “duration” column. You could perhaps convert each duration to a number (e.g. seconds) using Duration to Number and then doing something with them.

The upper flow effectively does “Duration to Number” manually without the intermediate creation of a Duration so. It uses Math Formula to directly convert H M S into seconds, using H*3600+M*60+S

At the far end it gives an example math formula where you can calculate differences or percentages or whatever based on the seconds values.

I’m not quite sure if this gives you what you need, but maybe it’s a stepping stone…
hhh mm ss Durations.knwf (38.6 KB)


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.