Date Math in the Column Expressions node

I would like to create an if statement in the Column Expressions node that would do something like this:

If isMissing(column(EndDate) then getNumberOfDays(column(“Created Date”),now()) else getNumberOfDays(column(“Created Date”),column(EndDate)). However, I can’t find any date math functions in the Column Expressions node. Any ideas on how this can be done?

Hi @Experteece , and welcome to the Knime Community.

Working with date is always tricky, and because of this, personally I prefer working with Knime nodes that are designed to handle dates such as the Date&Time Difference.

I understand that you are calculating differently based on some condition, but if you think about it, the only condition that you need to decide is whether to use what’s in the column EndDate or use now(). This can be done using the Rule Engine.

Sample workflow:
image

Input:
image

Results:
image

Here’s the workflow: Date diff.knwf (14.9 KB)

2 Likes

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