Converting time to range

Hi guys, I am new to KNIME and I want to convert hrs to hrs range. I tried with “Create Date&Time range” and “Duration to Number” but both didnt work.

Hrs Hrs Range
32 30 - 39
12 10 - 19
46 40 - 49

Welcome to the forum.

I tried with “Create Date&Time range” and “Duration to Number” but both didnt work.

Based on the descriptions of these nodes, they are never going to produce this result.

At first glance, when I look at the final table, I see the “Hrs Range” as bins, so I’d explore using one of the Binner nodes first. Alternately, you could use a series of Math Formula nodes to automatically calculate the ranges. Also possible is using a Rule Engine node to manually define rules for range classification.

At the same time, the table isn’t consistent. It starts off fine, but the bottom entries don’t fit (e.g. Hrs 480, Hrs Range 470-479; Hrs 32, Hrs Range 20-29) like I’d expect. What is the logic behind the ranges?


Hi @liz07,
as @elsamuel wrote your final result has a inconsistent logic.
Based on the first 4 rows you could use simple math formula node to get the lower and upper bound.

Min value = floor(Hrs/10)*10
Max value = Min value + 9

Finaly you have to convert this results to a string for your final column Hrs Range.


1 Like

Hi @liz07 -

Incidentally, is this an exercise for some coursework at a university? If so, I’d be curious to know what the class is, and who’s teaching it. I ask because it looks like the same dataset popped up in a separate thread yesterday:

Thanks! :slight_smile:

Please make sure that a sample data is provided. That always helps.

I would say by watching the picture there are 2 options.
Math Formula
Dictionary Binner


1 Like

Thank you guys! it worked!

1 Like

Hi, yes this is part of my final year project that was given by my lecturer, I am currently studying at Nanyang Polytechnic located in Singapore.

1 Like

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