With the start and end date, how should I list all the days in between this range without using R/SQL snippet?
This is the input:
Thanks in advance!
With the start and end date, how should I list all the days in between this range without using R/SQL snippet?
This is the input:
Thanks in advance!
Hi @nicole1201 and welcome to the Knime Community.
This can easily be done via the Create Date&Time Range node:
Here’s a quick example of it and how to configure it:
I’ve highlighted what needs to be configured. Basically set the type to Date since you only want dates.
Set the Start date and End date, and set interval to 1d
, which means 1 day. It will generate interval of 1 day between the start and end date.
For my example, I set the start date to 2022-05-27 and end date to 2022-06-04, and the result is as follows:
For your use case, you can convert your Start Date and End Date to variables, and then assign these variables as your start date and end date in the Create Date&Time Range node.
Something like this will do for you:
Input data (same as yours):
After converting to variables, I get these variables:
I configure the Create Date&Time Range the same way as before:
We don’t care about the Start and End date in the Options tab as we will override them with the 2 variables. Go to the Flow Variables tab and add them there:
Once you add the variables, you should see this message on the Options tab at the bottom:
Execute the node and you should get this:
Here’s the workflow:
Note: I was not sure when you said “list all the days” if you meant the dates or the days. The above showed how to list the dates. If you meant the days, you can add an extra node to do this, which is the Extract Date&Time Fields:
And you can get the Day of the week:
Which should give you this:
Thank you! This solves my problem
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.