Declaring start date and end date based on current month

Hello im trying to develop a monthly report i know how to sort it. But idk how i can take the current user month and declare the first day of the month as the start date and the last day of that month as the end date

Can anyone help me please?

Oh i found it for the first day u could use the :rounded to and for the last day u could do a simple calculation add the current month +1months, rounded it and then -1days

1 Like

Almost… Just one thing to correct…

Using that logic, the end date will be midnight on the morning of the last day of the month:

e.g.

Current Date (16th April 2024, 11:13am)
+1 month (16th May 2024, 11:13am)
Rounded down to month (1st May 2024, 00:00am)
-1Day (30th April 2024, 00:00am)

That means that anything that happens on 30th April will NOT be included in the report (in fact, the last day of any month will never be included in any reports using that logic)

So you don’t want to deduct a day from the start of the new month (unless you are deliberately intending to ignore things that happen on the last day of the month).

That is, unless it’s just for display purposes, in which case it’s fine (and correct).

But for the actual filtering of data, you’ll want to (presumably) include things that happen on the last day of the month, so remove the -1 Day from the equation, and just use < in your search constraints/filters.

Ah that make senses thank you!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.