Extract the date

Hello guys :grinning:

I need your help :innocent:

How to extract the date of the first day of the previous month and the date of the last day of the previous month?

Thank you :hugs:

1 Like

@NA_AN

Assign firstDayOfPrevMonth = Now.AddMonths(-1).AddDays(-Now.Day + 1)
Assign lastDayOfPrevMonth = Now.AddDays(-Now.Day).AddTicks(-1)

1 Like

Hi,

Can you try Modify Date activity as the following?

image

image

Regards,

1 Like

First date of previous month is New DateTime(Now.Year, Now.Month, 1).AddMonths(-1)

Last date of previous month is New DateTime(Now.Year, Now.Month, 1).AddDays(-1)

1 Like

Hi @NA_AN

  1. Assign activity: currentDate = Now
  2. Assign activity: previousMonthDate = currentDate.AddMonths(-1)
  3. Assign activity: firstDayOfPreviousMonth = new DateTime(previousMonthDate.Year, previousMonthDate.Month, 1)
  4. Assign activity: lastDayOfPreviousMonth = firstDayOfPreviousMonth.AddDays(-1)
1 Like

Have a look here:

AND / OR

grafik
now.AddDays(-now.Day + 1).AddMonths(-1).Date

1 Like

Hi @NA_AN

   
   firstDayOfPrevMonth = DateTime.Now.AddMonths(-1).AddDays(-DateTime.Now.Day + 1)
   
   lastDayOfPrevMonth = DateTime.Now.AddDays(-DateTime.Now.Day).AddTicks(-1)
   


image

1 Like

@NA_AN

please check the below attached screenshot

Hope it helps!!

1 Like

Thank you a lot :grinning:

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