Doing math formula with dates

Hello everyone,

I want to do this “((EndDate - ReportingDate - 0,5) / (EndDate - StartingDate)) x P”
formula on knime. But i couldn’t find how to calculate dates.

Thank you for your attention.

Hi @tahakorik

Welcome to KNIME Forum

0,5 day, 0,5 seconds, 0,5 year?
What should be the outcome of the calculation: days, weeks, seconds?

See the:Date&Time Difference node.
And many examples on the KNIME Hub.

gr. Hans


Hi @HansS

For example
StartDate: 7.21.2020
EndDate: 7.01.2021
ReportDate: 12.27.2020
0,5 : This is my calculation number
P : 978
(Date Format : mm/dd/yyyy)

**Result in excel : 525,85 **
with this formula “((EndDate - ReportingDate - 0,5) / (EndDate - StartingDate)) x P”

I want to do that calculation on Knime.

1 Like

Hi @tahakorik

see this wf: doing_math_with_dates.knwf (24.9 KB)

It looks like your date-difference is in: days :slight_smile:

gr. Hans


Hi @tahakorik and welcome to the Knime Community.

There is no standard answer to what “date_1 - date_2” is. For example, what would you say the answer to 2022/10/31 - 2021/10/31 is? Noone can really answer this unless we know if we’re talking in terms of year, or in terms of days, or in terms of hours, etc. And that is exactly what @HansS has asked you to confirm:

It’s a critical information that you missed on twice - first in your original post, and second in your other post after @HansS asked for clarification.

That’s like getting the size of something like 3x6x7, but they don’t tell you if that’s in inches or centimeters.


@HansS @bruno29a Thank you for your answers. It was very helpful. :smile:

1 Like

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