Filling Columns with dates based on base date

Hello,
to build the time axis for several different data sets I need to calc dates in the past and in the future for this axis based on a single date.

Example: I have given Year = 2023 and Month = 06
Now I need to calc the dates in YYYY-MM-DD for the months -20 (in the past) and +20 in the future. For every single month -20 up to +20 I have 1 column.

The Excel shows also what needs to be accomplished. Any idea how to get this filled table?

Your help is really appreciated!

Book1.xlsx (9.5 KB)

Look at Create Date&Time Range — NodePit
Node
Pass starting date as parameter and it has to work.

2 Likes

Hi @dev_python , as @izaychik63 mentioned, the key ingredient here is the Create Date&Time Range node.

However, there are quite a few things to be done to get to the output that you want, and it can be tricky.

I put something together in case you struggle with this. I used the same input data that you have:
image

I have also parameterized the past and future months via a Variable Creator:
image

This is the results that I get for a -20 months and +20 months:

The workflow looks like this:

And here’s the workflow: Filling Columns with dates base on given date.knwf (37.5 KB)

3 Likes

Great! Works as expected. Thanks for this!

2 Likes

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