How to get date

Hello guys

I have divided the year in to 4 quaters
Q1 = jan to march
Q2 = April to june
Q3 = July to sept
Q4 = oct to dec

scenario -
if rpa run on jan 2024 output should be

            out1=01/01/2023 out2=31/12/2023

If rpa run for april Output should be (Q1 completed)

           out1=01/01/2024 out2=31/03/2024 (Q1)

Hello @Gokul_Murali

Assign Multiple Variable with name Q1,Q2,Q3,Q4 Put Value With respect to the month date patterns or format you want like ( month-2 ) anything you want.

Apply If:
DateTime.Now.ToString(“MMM”)=“January” Or DateTime.Now.ToString(“MMM”)=“Febuary” Or
DateTime.Now.ToString(“MMM”)=“March” Or
Then
“Your Q1 Work here”

Else If DateTime.Now.ToString(“MMM”)=“April”
Or… Same Conditions As Above.
Then
“Q2 Work Here”

Same For All Quarters

Thanks
Happy Automation
hammad rafiq tukdi :slight_smile:

Hi @Gokul_Murali

Check the below workflow:


Sequence50.xaml (18.8 KB)

Hope it helps!!

Hi @Gokul_Murali ,

Check Below workflow, hope it helps you

Main.xaml (23.4 KB)

Regards,
Vinit Mhatre

Hi @Gokul_Murali

Apply if conditions for all the 4 months when you want to run the process.

for eg:

if todays date is Jan 22024, in if condition
assign firstdate = now.addmonths(-12).tostring(01/MM/yyyy)
lastdate = New datetime (now.Date.Year, now.Date.Month,1).AddDays (-1)(dd/MM/yyyy)

if todays date is Apr 2024, in if condition
assign firstdate = now.addmonths(-3).tostring(01/MM/yyyy)
lastdate = New datetime (now.Date.Year, now.Date.Month,1).AddDays (-1)(dd/MM/yyyy)