How to find month before today 3 days (working day)?

I want to find month before today 3 days (working Day —>not Saturday or Sunday )
Example If today = 01/04/2021 month = 4
I want to find days before today 3 day and not holiday.

result = 29/03/2021 month = 3

Please guide me about it please.

Hi @fairymemay

Let say you are storing the date inside a varaible let’s say date_1 of string type

Now use the below assign activitiy

date_2 = CDate(date_1).AddDays(-3).ToString(“dd/MM/yyyy”)

You can use while loop with condition as True

Now inside the while loop do the following,

now use if condition with condition as

CDate(date_2).Day.ToString.Equals(“Saturday”) Or CDate(date_2).Day.ToString.Equals(“Sunday”)

If the condition is true , then in then section use below

date_2= CDate(date_2).AddDays(-1).ToString(“dd/MM/yyyy”)

If the condition is false , then in else section use below

assign the month to a varible

month_1= CDate(date_2).ToString(“MM”)

Then use break activitiy after this assign , to break out if loop

Hope you got the idea ,

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

@NIVED_NAMBIAR It error as below,

image

variable date_2 = Date.Now.AddDays(-3).ToString(“dd/MM/yyyy”)
image

Please guide me for solve it.

Hi @fairymemay
apart from the logic i told ,

i used another way too

try this
it is working
Main.xaml (13.2 KB)

Regards,
Nived N
Happy Automation

2 Likes

@NIVED_NAMBIAR If I want convert from March to month name thai language (this is to convert April to เมษายน, english to thai)

Please guide me about it.

Hi @fairymemay
I had updated the workflow
check this
Main.xaml (13.2 KB)

the output i got
image

Regards,
Nived N
Happy Automation

1 Like

Hi @fairymemay

If it works please mark it as solution so that we can close the topic

1 Like

I guess other than weekends, Holidays should be considered right?? Say in the given example what if Mar 29th is holiday then you are looking for Mar 28 th right??

If yes, please check this post…

1 Like

@NIVED_NAMBIAR I have a question.

If I want to new 2 variable for year (2021) and month (04).
Please suggest about it.

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