Multiple columns of time into Seconds

Hi,

I’m having multiple “Local time (hh:mm:ss)” format based fields and I would like to convert all of them into seconds.

Any idea to perform all at once using loop functionality?

Regards,
Neelima

Hi @ngumpena , you can use the Date&Time Difference node.

Just configure it to find the difference from 00:00:00 and use Seconds as Granularity:

Since your second column is 00:00:00, you will get the results as negative.
image

Just apply the abs() function from the Math Formula node:

Results:
image

That’s how the workflow looks like:
image

EDIT: You do NOT need any loop. Knime will apply this to each row automatically for you

4 Likes

Hello @ngumpena,

if you are doing this for multiple columns one way to do it is indeed to use loop with @bruno29a’s logic inside it. See here an example of such a loop:

Another way is unpivot, apply logic, pivot approach which is faster as no loop is needed. See here:

Br,
Ivan

2 Likes

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