First Tuesday of Month

I want to create a procedure to add a record to my database which has a date of the first Tuesday of every month between two date ranges.

Is there a Panorama function that can determine the date of the first (or second, third etc) of a particular weekday in a month?

There are functions that determine the day of week of the 1st day of the month.


In my sample this code calculates the first Tuesdays:

field «1stWDay»
formulafill dayofweek(month1st(Start))

field «1stTuesday»
Formulafill ?(«1stWDay» > 2,Start + 9 - «1stWDay»,
    ?(«1stWDay» = 2,Start,
    Start + (2 - «1stWDay»)))

Read the documentation about Date Arithmetic Formulas:

Thanks for your help and pointing me in the right direction. :slightly_smiling_face:

Here is an example of a formula to calculate the date of the first Tuesday in November this year.

The date in the parameter of the month1st( function can be any date in the month in question.

In the examples offered, I don’t see how incorporating a start and end date range is done. It seems you might need to increment something in a loop. Would you calculate the first month/year and the last month/year, then generate the Tuesday records a month at a time - for example, using Dave’s formula - with a loop incrementing from monthstart to monthend?

Yes you are correct.
I already had coded the loop with the incrementing. It was just the bit to set the correct date for the 1st Tuesdya of the month that I was missing.