Return the date in the specified month of the specified year corresponding to the specified nth occurrence of the specified dayOfWeek. If n < 0, return the date corresponding to the -nth occurrence of the dayOfWeek counting from the end of the month towards the first of the month. If 5 == n and a result cannot be found in month, then return the date of the first dayOfWeek in the following month. If -5 == n and a result cannot be found in month, then return the date of the last dayOfWeek in the previous month. The behavior is undefined unless 1 <= year <= 9999, 1 <= month <= 12, n != 0, -5 <= n <= 5, and the resulting date is neither earlier than 0001/01/01 nor later than 9999/12/31.
Declared in <bdlt_dateutil.h>
static
Date
nthDayOfWeekInMonth(
int year,
int month,
DayOfWeek::Enum dayOfWeek,
int n);
For example: ` nthDayOfWeekInMonth(2004, 11, DayOfWeek::e_THURSDAY, 4); ` returns November 25, 2004, the fourth Thursday in November, 2004.