I think that Pete has a great solution for the 2nd Tuesday of the month.

But if you need the next 2nd Tuesday of the month (ie maybe the 2nd Tuesday of the month has already occurred) we can build on the formula like this.

var date TestDate = Today()+ Days(0); // you can adjust this Days(0) to test for different dates.

var number firstdayofcurrentmonth = DayOfWeek(FirstDayOfMonth($TestDate));

var number deltaOne = 9 - $firstdayofcurrentmonth;

var date SecondTuesdayOfThisMonth = If ($deltaOne < 2, FirstDayOfMonth($TestDate) + Days($deltaOne),FirstDayOfMonth($TestDate) + Days($deltaOne + 7) );

var number firstdayofnextmonth = DayOfWeek(AdjustMonth(FirstDayOfMonth($TestDate),1));

var number deltaTwo = 9 - $firstdayofnextmonth;

var date SecondTuesdayOfNextMonth = If ($deltaTwo < 2, AdjustMonth(FirstDayOfMonth($TestDate),1) + Days($deltaTwo),AdjustMonth(FirstDayOfMonth($TestDate),1) + Days($deltaTwo + 7) );

If(Today() <= $SecondTuesdayOfThisMonth, $SecondTuesdayOfThisMonth, $SecondTuesdayOfNextMonth)

------------------------------

Mark Shnier (YQC)

mark.shnier@gmail.com------------------------------

Original Message:

Sent: 09-06-2021 05:27

From: Pete James

Subject: Calculate next 2nd Tuesday of a month

How about this.. where test date is the date you are using to identify the month

var number firstday = DayOfWeek(FirstDayOfMonth([test date]));

var number delta = 9 - $firstday;

If ($delta < 2, FirstDayOfMonth([test date]) + Days($delta),FirstDayOfMonth([test date]) + Days($delta + 7) )

------------------------------

Pete James

Original Message:

Sent: 09-03-2021 15:59

From: Prashant Maheshwari

Subject: Calculate next 2nd Tuesday of a month

I have a task due to submit every 2nd Tuesday of month , for life of me I can't figure how to calculate next instance .

------------------------------

Prashant Maheshwari

------------------------------