Convert duration to HH:MM:SS

Hi everyone,

I am trying to convert 3 columns that have the durations in seconds to the format hh:mm:ss

For example the first row in the first column (5 seconds call duration) should look like this: 00:00:05

Unfortunately I am not able to share any more of the data as it contains confidential information.

Any help would be appreciated.

image

Hello @WesselHL , and welcome to the KNIME community.

You can test with ‘Column Expressions’ node (Type == Local Time / String):

hours = padLeft(floor(column("time_sec")/3600), 2, "0")
minutes = padLeft(floor(mod(column("time_sec")/3600, 1)*60), 2, "0")
seconds = padLeft(mod(column("time_sec"),60), 2, "0")

join(
    hours
    , ":"
    , minutes
    , ":"
    , seconds
)

BR

5 Likes

Hi @gonhaddock ,

This worked thank you

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