# 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?

Br,
Ivan

4 Likes

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?

3 Likes

Hello,

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!

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)

2 Likes

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