|
BDE 4.14.0 Production release
|
Provide stateless functions for calendar-based BUS-252.
This component provides a struct, bbldc::CalendarBus252, that serves as a namespace for defining a suite of date-related functions used to compute the day count and the year fraction between two dates as per the BUS-252 day-count convention. In this day-count convention, the day count between two ordered dates, beginDate and endDate where beginDate < endDate, is exactly the number of business days occurring in the time period [beginDate .. endDate). Reversing the order of the dates negates the result. When the two dates have the same value, the day count is 0. The year fraction is the day count divided by 252.
This section illustrates intended use of this component.
The following snippets of code illustrate how to use bbldc::CalendarBus252 methods. First, create two bdlt::Date variables, d1 and d2:
Then, create a calendar with a valid range spanning 2003 and typical weekend days:
Next, compute the day count between d1 and d2:
Finally, compute the year fraction between the two dates: