Last Day of the month

Hi everyone,

I hope you are doing well,
I need to extract the last day of the current month, but i dont know how? Can you help me, please ?

Are you looking to just return the row that represents last day of the current month that exists as a record and your table, or calculate the last day of the month for every date in a column, or just the last calendar day of the month in general based on the execution date of the workflow? As a general starting point, I typically use the Date&Time Extractor node to split my date into fields info that helps me in expression building.

1 Like

Hi @sergioSB,

“Current dates” are something that come up periodically, and I’m always slightly surprised that there isn’t a dedicated node for the purpose. Maybe one day :wink:

There is however a call (aka “String Manipulation hack”) that you can add to String Manipulation or String Manipulation (Variable) which will return you the last date of the current month.

string(
  java.time.YearMonth.now().atEndOfMonth()
      .format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd") )
)

It’s not exactly easy to remember, so I’ve added it and similar into several “Date” components. I’m gradually adding to the list as different suggestions appear.

If you want to return it as a variable, you can use Date Retriever (Variable), and select the required date to return. The “Variable” version will return a String variable containing the date in yyyy-MM-dd format.

To return it as a Column, choose the required component from the “non-variable” components
image

The Column versions, return it as a Date column.

from the following hub space:

5 Likes

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