Convert time to number

Hello!

I am trying to convert Hours/Minutes to decimal time. In excel we just create a formula that multiplies the field by 24 and it converts it. When I am pulling my original report into Knime it sees it as a string and I can’t figure out how to get it to convert to a number and or time in order for me to get the result shown in the second column below:

HOURS CONVERTED BY *24
114:38 114.6333333
34:01 34.01666667

Thank you!

The solution that comes to my mind first involves converting the inputted string to a KNIME duration, then to a number:
image

  1. Start with the input table:
    image

  2. Convert to a properly formatted duration string using the String Manipulation node:

    image

    H is for hours, m is for minutes. See the description of the String to Duration node for details on the formatting.

  3. Convert this string to duration:

    image

  4. Convert this duration to a number:
    image

    image

5 Likes

Perfect! Thank you so much!

1 Like