How to get date of 2nd and 4th Tuesday of current month?

Hello!

My whole answer is in the topic.

How to get date of 2nd and 4th Tuesday of current week?

please give me your great wisdom :slight_smile:

This makes no sense. There is only one Tuesday per week. Did you mean 2nd and 4th Tuesday of current month?

Hi @Golf_Aquascape

Use assign activity and assign following below syntax:

currentDate(Datatype: System.DateTime) = DateTime.Now.Date

dayOfWeek(DataType: System.DayOfWeek) = currentDate.DayOfWeek

daysToAddFor2ndTuesday(Datatype: System.Int32) = If(dayOfWeek <= DayOfWeek.Tuesday, DayOfWeek.Tuesday - dayOfWeek + 7, DayOfWeek.Tuesday - dayOfWeek + 14)

secondTuesdayDate(Datatype: System.DateTime) = currentDate.AddDays(daysToAddFor2ndTuesday)

daysToAddFor4thTuesday(Datatype: System.Int32) = If(dayOfWeek <= DayOfWeek.Tuesday, DayOfWeek.Tuesday - dayOfWeek + 21, DayOfWeek.Tuesday - dayOfWeek + 28)

fourthTuesdayDate(Datatype: System.DateTime) = currentDate.AddDays(daysToAddFor4thTuesday)

Print secondTuesdayDate and fourthTuesdayDate using a message Box or Log Message to check.

Note: Attached workflow for reference
Sequence3.xaml (10.7 KB)

Hope it helps!!
Regards,

Oh Thank you for that !!

Wow… that is great. will try

I mean, month :slight_smile: my mistake.

I tried to. but it did not work properly. output date was not the date that I told you.

I don’t know VB word …I am studying VB words with UiPath :frowning: … Can you make lines with Assign acitivity for me?

You’d put that into an Invoke Code and pass in/out the necessary values.