Date&Time Difference: Consider starting date / Add option to in-/exclude start date


while working on an solution for another post and cross validating some sample data I noticed the Date&Time Difference node does not factor in nor provides the option to in-/exclude the start or end date.

That always results in a difference which can lead to miscalculations due to misinterpretations. I.e. by factoring in all days between 2023-01-25 and 2023-01-30 one could count six days but Knime, as the node correctly states, only calculates the difference (30-5).

Sample Data

Date 1 Date 2 Days Total expected (Chat GPT) Days diff calculated
2021-11-15 2022-01-22 69 68
2021-07-13 2022-08-31 415 414
2021-05-01 2021-06-03 34 33
2022-04-15 2022-07-06 83 82
2022-02-02 2022-03-20 47 46
2023-01-25 2023-01-30 6 5
2023-01-30 2023-02-03 5 4
2023-01-25 2023-02-06 13 12
2023-01-04 2023-02-06 34 33
2023-01-19 2023-03-13 54 53

Hence, I added both labels bug and feature-request to also make it more apparent to the user.


Hey Mike,

thank you for the nice comparison of Date time differences.
The Date&Time Difference node can also calculate the time difference between two time stamps. If we calculate the time difference between 18:00 and 06:00 we would expect 12h. Our goal is to be consistent in that sense, also for Date- and Date&Time Stamps.
I hope that my answer has given you some context of why the node was developed the way it is.
Would you also see a use case of your feature request for formats other than the date?

All the best

Hi @lgknime ,

I’ve added my vote to @mwiegand 's post as I’ve also considered it would be useful to have the option of including and excluding the start and end.

Yes, probably I’d use it mostly for dates, but no harm in just making the option available, with it defaulting to “difference” rather than what I guess is “total number in range”.

Dates are certainly a special case, in my view, and the use cases I’ve seen on the forum can be things such as:

“count the number of days worked”

  • given a date range for which you’d typically want an inclusive range as it marks the beginning and end of a work period.
    (e.g. If I work from Monday to Friday, I consider that 5 days and not 4 no matter what my boss thinks of my work ethic on a Friday :wink: ! )

“Calculate the number of days it took to deliver an order”

  • given a date range, for which you’d typically want an exclusive range
    (e.g. ordered Monday, received Friday - I would consider that to be 4 days)

So for dates, to me I can see very common use cases both ways, and having to keep throwing in a Math Formula node to do a (plus one) niggles… especially if it’s on a friday! :wink: