Last day of the previous month

Hi friends, I would like to know the last day of the previous month, considering today.And show that day in a MessageBox.

Example1: If Today is 02/01/2018, then I want to see “01/31/2018”
Example2: If Today is 10/17/2018, then I want to see “09/30/2018”

Do you have a workflow with this? Thank you very much!!

3 Likes

Assign endofpreviousMonth = New datetime(yourdate.Year, yourdate.Month,1).AddDays(-1)

2 Likes

On the back of @Uemoe suggestion, if you want to make this automatic then use this:

New datetime(now.Date.Year, now.Date.Month,1).AddDays(-1)

It will output:
image

datedisplay.xaml (4.9 KB)

15 Likes

@Uemoe @CBlanchard Thank you so much friends!! :smiley: