Concrete date class.
More...
#include <date.hpp>
Concrete date class.
This class provides methods to inspect dates as well as methods and operators which implement a limited date algebra (increasing and decreasing dates, and calculating their difference).
- Tests:
- self-consistency of dates, serial numbers, days of month, months, and weekdays is checked over the whole date range.
- Examples
- BasketLosses.cpp, BermudanSwaption.cpp, Bonds.cpp, CDS.cpp, CVAIRS.cpp, CallableBonds.cpp, ConvertibleBonds.cpp, DiscreteHedging.cpp, EquityOption.cpp, FRA.cpp, FittedBondCurve.cpp, Gaussian1dModels.cpp, LatentModel.cpp, MulticurveBootstrapping.cpp, Replication.cpp, and Repo.cpp.
Definition at line 125 of file date.hpp.
◆ serial_type
serial number type
Definition at line 128 of file date.hpp.
◆ Date() [1/3]
◆ Date() [2/3]
Constructor taking a serial number as given by Applix or Excel.
Definition at line 61 of file date.cpp.
◆ Date() [3/3]
More traditional constructor.
Definition at line 66 of file date.cpp.
◆ weekday()
◆ dayOfMonth()
◆ dayOfYear()
One-based (Jan 1st = 1)
Definition at line 404 of file date.hpp.
◆ month()
◆ year()
◆ serialNumber()
◆ operator+=() [1/2]
increments date by the given number of days
Definition at line 101 of file date.cpp.
◆ operator+=() [2/2]
increments date by the given period
Definition at line 108 of file date.cpp.
◆ operator-=() [1/2]
decrement date by the given number of days
Definition at line 113 of file date.cpp.
◆ operator-=() [2/2]
decrements date by the given period
Definition at line 120 of file date.cpp.
◆ operator++() [1/2]
1-day pre-increment
Definition at line 125 of file date.cpp.
◆ operator++() [2/2]
1-day post-increment
Definition at line 776 of file date.cpp.
◆ operator--() [1/2]
1-day pre-decrement
Definition at line 132 of file date.cpp.
◆ operator--() [2/2]
1-day post-decrement
Definition at line 782 of file date.cpp.
◆ operator+() [1/2]
returns a new date incremented by the given number of days
Definition at line 412 of file date.hpp.
◆ operator+() [2/2]
returns a new date incremented by the given period
Definition at line 420 of file date.hpp.
◆ operator-() [1/2]
returns a new date decremented by the given number of days
Definition at line 416 of file date.hpp.
◆ operator-() [2/2]
returns a new date decremented by the given period
Definition at line 424 of file date.hpp.
◆ todaysDate()
◆ minDate()
earliest allowed date
Definition at line 766 of file date.cpp.
◆ maxDate()
latest allowed date
Definition at line 771 of file date.cpp.
◆ isLeap()
whether the given year is a leap one
Definition at line 187 of file date.cpp.
◆ endOfMonth()
last day of the month to which the given date belongs
Definition at line 428 of file date.hpp.
◆ isEndOfMonth()
whether a date is the last day of its month
Definition at line 434 of file date.hpp.
◆ nextWeekday()
◆ nthWeekday()
◆ minimumSerialNumber()
◆ maximumSerialNumber()
◆ checkSerialNumber()
◆ advance()
◆ monthLength()
◆ monthOffset()
◆ yearOffset()
◆ operator-()
Difference in days between dates.
Definition at line 438 of file date.hpp.
◆ daysBetween()
Difference in days (including fraction of days) between dates.
Definition at line 442 of file date.hpp.
◆ operator==()
◆ operator!=()
◆ operator<()
◆ operator<=()
◆ operator>()
◆ operator>=()
◆ hash_value()
std::size_t hash_value |
( |
const Date & |
d | ) |
|
|
related |
Compute a hash value of d
.
This method makes Date hashable via boost::hash
.
Example:
#include <unordered_set>
std::unordered_set<Date> set;
Date()
Default constructor returning a null date.
- Parameters
-
- Returns
- A hash value of
d
Definition at line 846 of file date.cpp.
◆ operator<<()
std::ostream & operator<< |
( |
std::ostream & |
, |
|
|
const Date & |
|
|
) |
| |
|
related |
◆ serialNumber_