Skip to main content
Question

Calculate next 2nd Tuesday of a month

  • September 3, 2021
  • 0 replies
  • 208 views

Forum|alt.badge.img+11
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
------------------------------

Forum|alt.badge.img+14
I don't have time to play around with it right now, but I have this in my notes. Not your use case but maybe you can reverse engineer it and use it to come up with a solution? Though, I can't help but think there is a much easier way. Lets hope @Mark Shnier (YQC) can come to the rescue!

My Notes:

Calculate the previous Thursday on or before a date (in a due date field). So for example, if the Due Date was a Monday, I wanted the date of the previous Thursday. No matter the due date, I wanted the date of the prior Thursday (or if the due date was a Thursday, then I want that Thursday).

For Prior Wednesday: [Due Date] - Days(Rem(DayOfWeek([Due Date])+4,7))
For Prior Thursday: [Due Date] - Days(Rem(DayOfWeek([Due Date])+3,7))
For Prior Friday: [Due Date] - Days(Rem(DayOfWeek([Due Date])+2,7))
etc.

(Sunday would be + 7, Saturday would be +1)​​

------------------------------
Michael Tamoush
------------------------------

  • Registered
  • September 6, 2021
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
------------------------------