Date in Column name

Capture

For the column “Amount” I need that to display the last day of the month based on the date I run the flow. For example, If I run it today, I need that column to display 11/30/2022

I currently modify it after I write it in an excel file but was wondering if Knime can help me out.

Hi @lazaronewhall17 and welcome to the Knime Community.

Here’s how you can do this:

Input table:
image

Results:
image

Of course, you can format the date as you want. My locale is en-CA. It (the format) might automatically change for you depending on your locale, or you can manually format the date.

This is how you can get current date, with the Create Date&Time Range node configured like this:

Which gives me this as current date:
image

Now, that’s not quite interesting as a test, since it’s already the last day of the current month. To do a real test, I will change that date (only for testing).

I’ll modify the date to Sept 14, 2022:

And confirmation of the date:
image

When I execute the workflow with this date, the Amount column is renamed to the last date of September:
image

Here’s another test if today was Feb 23rd:
image

Results:
image

So, it will automatically rename to the last date of the month whenever you run the workflow.

Here’s the workflow:

8 Likes

Bruno29a,

Thank you so much for the support and all the details. Hopefully one day I can resolve one of your questions. Just give me some time to catch up :slight_smile:

3 Likes

So far, noone has had this chance, since I’ve not created any topic yet :wink:

4 Likes

That hardly seems fair to the rest of us @bruno29a ! :rofl:

Not that I really want to tackle whatever mind breaker you would hit us with…

2 Likes

It’s not by design @iCFO :smiley:

1 Like

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