How to get the first date and last date of previous month till 5th of every month

Hi Team,

I have already implemented a logic to get the first date and last date of current month but i need first date and last date of previous month till 5th of every month after 5th it should consider current month of first date and last date,

My logic to get the first date and last date
First date : New DateTime(Now.Year,Now.Month,1).ToString(“dd.MM.yyyy”)

Last date: New datetime(now.Date.Year, now.Date.Month,1).AddMonths(1).AddDays(-1).ToString(“dd.MM.yyyy”, System.Globalization.CultureInfo.CurrentCulture)

but i think using some if condition we may get the logic to consider the date as i required but not sure hw to create that logic…it is so confusing

Note: When the bot runs in current month it always should select the first date and last date of previous month in SAP till 5th of every month but when the bot runs after 5th it always should consider current month first date and last date. Hope you got what i wanted

FindDate.xaml (6.5 KB)
Please check the attached wf and confirm if it works

1 Like

thank you so much, it is working super fine

1 Like

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