nthOccurrenceOfDayInMonth

nthOccurrenceOfDayInMonth(dayOfWeek:  Integer; 
                          occurrence: Integer): Date;

The nthOccurrenceOfDayInMonth method of the Date primitive type returns the date identical to that of the receiver except the day is modified to match the nth occurrence (that is, the first, second, third, fourth, or fifth) of the day of the week that matches the specified dayOfWeek parameter.

The Integer values of the dayOfWeek parameter are listed in the following table.

Integer Value Corresponding Day
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday
7 Sunday

This method returns a null date if the nth day of the week does not exist (for example, there is no fifth Saturday in January 2020).

2020.0.01 and higher