Last day in month

I need to assign last day of month to variable. Problem is of course with Febuary. How can I set it dynamicly. 28 or 29 for each 4 years.

Anybody ? :slight_smile:

@kilerfcb

Check as below

Mark as solution if this helps

Thanks

Great. Thank you !

1 Like

For working on datetime base have a look here:
grafik

ensure follwoing:
grafik

Hi @kilerfcb

To get the total number of days of the current month in the current year in a dynamic way every time you run the code, instead of providing year and month in the expression.

This might help you.
DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)

Additional Info:
For previous month’s - DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.AddMonths(-1).Month)

Just change the integer and its sign to get the required month’s total days.

Cheers,
Prajwal!!

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