Last 5 days of current month

Hi,

Can anyone help me how to get last 5 days of current month.

for ex: i need to get 25 th to 30 th of every month

Please help.
Thanks

Hey use this

Last Day : DateTime.DaysInMonth(Datetime.Now.Year, Datetime.now.Month)

5th Day from Last : (DateTime.DaysInMonth(Datetime.Now.Year, Datetime.now.Month) -5)

1 Like

it looks like you are interested in a series/Collection of the last 5 days fro current month (so e.g. in Feb: 24,25,26,27,28)

Variables:

Assign:
grafik

Enumerable.Range(-4,5).Select(Function (x) LastMonthDate.AddDays(x)).toList

Result:

4 Likes

Thanks @ppr its perfect

Hi Peter,

Could we also get days 'name ’ (Sun,Mon,Tue) somehow?

Thanks!

we can do it within an second statement on the retrived dates. Feel free to open a new topic on your case

1 Like

I got it. Thanks

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