|
static int | addBusinessDaysIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar, int numBusinessDays) |
|
static int | nthBusinessDayOfMonthOrMaxIfValid (bdlt::Date *result, const bdlt::Calendar &calendar, int year, int month, int n) |
|
static int | shiftFollowingIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar) |
|
static int | shiftIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar, ShiftConvention convention) |
|
static int | shiftIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar, ShiftConvention convention, bdlt::DayOfWeek::Enum specialDay, bool extendSpecialDay, ShiftConvention specialConvention) |
|
static int | shiftModifiedFollowingIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar) |
|
static int | shiftModifiedPrecedingIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar) |
|
static int | shiftPrecedingIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar) |
|
static int | subtractBusinessDaysIfValid (bdlt::Date *result, const bdlt::Date &original, const bdlt::Calendar &calendar, int numBusinessDays) |
|
This struct
provides a namespace for utility functions that operate on dates in the context of supplied calendars.
Load, into the specified result
, the date that is the specified numBusinessDays
chronologically after the specified original
date according to the specified calendar
. The resulting date is chronologically before the original
date for negative values of numBusinessDays
, the chronologically earliest business day that is on or after the original
date for 0 == numBusinessDays
, and chronologically after the original
date for positive values of numBusinessDays
. Return 0 on success, and a non-zero value, without modifying *result
, if either the original
date or the resulting date is not within the valid range of calendar
. Note that if 0 != numBusinessDays
, then the result of addBusinessDaysIfValid(res, orig, cal, numBusinessDays)
is identical to the result of subtractBusinessDaysIfValid(res, orig, cal, -numBusinessDays)
.
static int bdlt::CalendarUtil::nthBusinessDayOfMonthOrMaxIfValid |
( |
bdlt::Date * |
result, |
|
|
const bdlt::Calendar & |
calendar, |
|
|
int |
year, |
|
|
int |
month, |
|
|
int |
n |
|
) |
| |
|
static |
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
.
Load, into the specified result
, the date of the business day that is derived from the specified original
date based on the specified calendar
according to the specified date-shifting convention
, except when the original
is either the specified specialDay
of the week, or - if the specified extendSpecialDay
is true
- one of the (possibly empty) set of contiguous non-business days immediately preceding a specialDay
according to the calendar
, in which case the result
is determined using the specified specialConvention
. Return 0 on success, and a non-zero value, without modifying *result
, if a valid business date cannot be found according to the above algorithm within the valid range of calendar
. Note that this method is useful for computing, for example, Korean bond coupon payment dates.
Load, into the specified result
, the date of the chronologically earliest business day that is on or after the specified original
date, unless a date cannot be found in the same month, in which case load the chronologically latest business day before the original
date based on the specified calendar
. Return 0 on success, and a non-zero value, without modifying *result
, if the original
date is not within the valid range of calendar
or a valid business date cannot be found according to the above algorithm within the valid range of calendar
.
Load, into the specified result
, the date of the chronologically latest business day that is on or before the specified original
date, unless a date cannot be found in the same month, in which case load the chronologically earliest business day after the original
date based on the specified calendar
. Return 0 on success, and a non-zero value, without modifying *result
, if the original
date is not within the valid range of calendar
or a valid business date cannot be found according to the above algorithm within the valid range of calendar
.
Load, into the specified result
, the date that is the specified numBusinessDays
chronologically before the specified original
date according to the specified calendar
. The resulting date is chronologically before the original
date for positive values of numBusinessDays
, the chronologically latest business day that is on or before the original
date for 0 == numBusinessDays
, and chronologically after the original
date for negative values of numBusinessDays
. Return 0 on success, and a non-zero value, without modifying *result
, if either the original
date or the resulting date is not within the valid range of calendar
. Note that if 0 != numBusinessDays
, then the result of subtractBusinessDaysIfValid(res, orig, cal, numBusinessDays)
is identical to the result of addBusinessDaysIfValid(res, orig, cal, -numBusinessDays)
.