Load, into the specified result, the date corresponding to the specified n`th business day of the specified `month and the specified year based on the specified calendar. A positive value of n indicates that counting the number of business days begins from the first calendar date of the month (inclusive), and a negative value of n indicates that counting the number of business days begins from the last calendar date of the month (inclusive). If there are fewer than abs(n) business days in the month according to the calendar, the business day furthest from the first date of the month is chosen if n > 0, and the business day furthest from the last date of the month is chosen if n < 0. Return 0 on success, and a non‐zero value, without modifying *result, if the entire month specified by year and month is not within the valid range of the calendar or there are no business days in the month specified by year and month. The behavior is undefined unless n != 0, 1 <= year <= 9999, and 1 <= month <= 12.

Synopsis

Declared in <bdlt_calendarutil.h>

static
int
nthBusinessDayOfMonthOrMaxIfValid(
    bdlt::Date* result,
    bdlt::Calendar const& calendar,
    int year,
    int month,
    int n);

Created with MrDocs