#include <date.h>
Inheritance diagram for Date:
Public Member Functions | |
Date (void) | |
Default constructor. | |
Date (LongInteger serialNumber) | |
Constructor taking a serial number. | |
Date (Day d, Month m, Year y) | |
Constructor taking day, month and year. | |
Date (Day d, ShortNatural m, Year y) | |
Constructor taking day, month as an integer and year. | |
~Date (void) | |
Weekday | weekday () const |
Day | dayOfMonth () const |
Day | dayOfYear () const |
Month | month () const |
Year | year () const |
LongInteger | serialNumber () const |
bool | isEndOfMonth () const |
Day | lastDayOfMonth () const |
void | setDateToToday () |
Set Date to system today's date. | |
Date & | operator+= (LongInteger days) |
increments date by the given number of days | |
Date & | operator-= (LongInteger days) |
decrement date by the given number of days | |
Date & | operator++ () |
1-day pre-increment | |
Date | operator++ (int) |
1-day post-increment | |
Date & | operator-- () |
1-day pre-decrement | |
Date | operator-- (int) |
1-day post-decrement | |
Date | operator+ (LongInteger days) const |
returns a new date incremented by the given number of days | |
Date | operator- (LongInteger days) const |
returns a new date decremented by the given number of days | |
bool | operator== (const Date &d2) |
bool | operator!= (const Date &d2) |
bool | operator< (const Date &d2) |
bool | operator<= (const Date &d2) |
bool | operator> (const Date &d2) |
bool | operator>= (const Date &d2) |
Date | plusDays (Integer n) const |
Date | plusWeeks (Integer n) const |
Date | plusMonths (Integer n) const |
Date | plusYears (Integer n) const |
Date | plus (Integer n, TimeUnit units) const |
bool | isBusinessDay () |
Apply Conventions (use for UsDate for example). | |
void | applyConvention (BusinessDayConvention convention=Following) |
Date | returnDateConvention (const Date &date, BusinessDayConvention convention=Following) |
Real | dayCount (const Date &d, DayCountConvention dayconvention=ACT_365) const |
DayCount Between Dates. | |
char * | toString () const |
Return char* version of the date. | |
Static Public Member Functions | |
Date | minDate () |
earliest allowed date | |
Date | maxDate () |
latest allowed date | |
bool | isLeap (Year y) |
whether the given year is a leap one | |
Date | endOfMonth (const Date &d) |
last day of the month to which the given date belongs | |
bool | isEOM (const Date &d) |
whether a date is the last day of its month | |
Date | nextWeekday (const Date &d, Weekday) |
next given weekday following or equal to the given date | |
Date | nthWeekday (ShortInteger n, Weekday, Month m, Year y) |
n-th given weekday in the given month and year | |
Static Private Member Functions | |
Date | advance (const Date &d, Integer units, TimeUnit) |
Integer | monthLength (Month m, bool leapYear) |
Integer | monthOffset (Month m, bool leapYear) |
LongInteger | yearOffset (Year y) |
LongInteger | minimumSerialNumber () |
LongInteger | maximumSerialNumber () |
Private Attributes | |
LongInteger | _serialNumber |
|
Default constructor.
Definition at line 4 of file date.cpp. References LongInteger. Referenced by advance(), applyConvention(), Date(), endOfMonth(), nthWeekday(), operator+(), operator-(), and returnDateConvention(). |
|
Constructor taking a serial number.
Definition at line 8 of file date.cpp. References LongInteger. |
|
Constructor taking day, month and year.
Definition at line 12 of file date.cpp. References _serialNumber, Day, isLeap(), m, monthLength(), monthOffset(), Year, and yearOffset(). |
|
Constructor taking day, month as an integer and year.
Definition at line 18 of file date.cpp. References April, August, Date(), Day, December, February, January, July, June, m, March, May, November, October, September, ShortNatural, and Year. |
|
|
|
Definition at line 175 of file date.cpp. References Date(), Day, dayOfMonth(), Days, February, Integer, isLeap(), m, Month, month(), monthLength(), Months, Weeks, year(), Year, and Years. Referenced by plus(), plusDays(), plusMonths(), plusWeeks(), and plusYears(). |
|
Definition at line 366 of file date.cpp. References _serialNumber, Date(), Following, isBusinessDay(), LongInteger, ModifiedFollowing, ModifiedPreceding, month(), and Preceding. Referenced by bond::getCashflow(), returnDateConvention(), and SwapLeg::SwapLeg(). |
|
DayCount Between Dates.
Definition at line 397 of file date.cpp. References _serialNumber, ACT_360, ACT_365, Day30_360, Day30_365, dayOfMonth(), month(), Real, serialNumber(), TN_REAL, and year(). Referenced by bond::convexity(), yieldCurve::discountFactor(), bond::duration(), asset::forwardPrice(), yieldCurve::forwardRate(), volsurface::forwardVolatility(), bond::getCashflow(), bond::getMaturityInYears(), riskybond::quotedPrice(), bond::quotedPrice(), volsurface::setvolsurface(), yieldCurve::spotRate(), volsurface::volatility(), and bond::yieldToMaturity(). |
|
Definition at line 53 of file date.cpp. References Day, dayOfYear(), isLeap(), month(), monthOffset(), and year(). Referenced by advance(), dayCount(), bond::fairvalue(), UsDate::isBusinessDay(), isEOM(), lastDayOfMonth(), and toString(). |
|
Definition at line 57 of file date.cpp. References _serialNumber, Day, year(), and yearOffset(). Referenced by dayOfMonth(), and month(). |
|
last day of the month to which the given date belongs
Definition at line 263 of file date.cpp. References Date(), isLeap(), m, month(), Month, monthLength(), year(), and Year. Referenced by lastDayOfMonth(). |
|
Apply Conventions (use for UsDate for example).
Reimplemented in UsDate. Definition at line 362 of file date.cpp. Referenced by applyConvention(). |
|
Definition at line 83 of file date.cpp. References isEOM(). |
|
whether a date is the last day of its month
Definition at line 269 of file date.cpp. References dayOfMonth(), isLeap(), month(), monthLength(), and year(). Referenced by isEndOfMonth(). |
|
whether the given year is a leap one
Definition at line 215 of file date.cpp. References Year. Referenced by advance(), Date(), dayOfMonth(), endOfMonth(), isEOM(), month(), and setDateToToday(). |
|
Definition at line 87 of file date.cpp. References Day, dayOfMonth(), and endOfMonth(). Referenced by maindate(). |
|
latest allowed date
Definition at line 170 of file date.cpp. References maximumSerialNumber(). |
|
Definition at line 358 of file date.cpp. References LongInteger. Referenced by maxDate(). |
|
earliest allowed date
Definition at line 165 of file date.cpp. References minimumSerialNumber(). |
|
Definition at line 354 of file date.cpp. References LongInteger. Referenced by minDate(). |
|
Definition at line 61 of file date.cpp. References Day, dayOfYear(), Integer, isLeap(), m, Month, monthOffset(), and year(). Referenced by advance(), applyConvention(), dayCount(), dayOfMonth(), endOfMonth(), bond::fairvalue(), UsDate::isBusinessDay(), isEOM(), and toString(). |
|
Definition at line 285 of file date.cpp. Referenced by advance(), Date(), endOfMonth(), isEOM(), and setDateToToday(). |
|
Definition at line 295 of file date.cpp. Referenced by Date(), dayOfMonth(), month(), and setDateToToday(). |
|
next given weekday following or equal to the given date
|
|
n-th given weekday in the given month and year
Definition at line 278 of file date.cpp. References Date(), m, ShortInteger, Weekday, and Year. |
|
Definition at line 124 of file date.h. References _serialNumber, and serialNumber(). |
|
returns a new date incremented by the given number of days
Definition at line 137 of file date.cpp. References _serialNumber, Date(), and LongInteger. |
|
1-day post-increment
Definition at line 117 of file date.cpp. References _serialNumber, and LongInteger. |
|
1-day pre-increment
Definition at line 111 of file date.cpp. References _serialNumber, and LongInteger. |
|
increments date by the given number of days
Definition at line 99 of file date.cpp. References _serialNumber, and LongInteger. |
|
returns a new date decremented by the given number of days
Definition at line 141 of file date.cpp. References _serialNumber, Date(), and LongInteger. |
|
1-day post-decrement
Definition at line 130 of file date.cpp. References _serialNumber, and LongInteger. |
|
1-day pre-decrement
Definition at line 124 of file date.cpp. References _serialNumber, and LongInteger. |
|
decrement date by the given number of days
Definition at line 105 of file date.cpp. References _serialNumber, and LongInteger. |
|
Definition at line 125 of file date.h. References _serialNumber, and serialNumber(). |
|
Definition at line 126 of file date.h. References _serialNumber, and serialNumber(). |
|
Definition at line 123 of file date.h. References _serialNumber, and serialNumber(). |
|
Definition at line 127 of file date.h. References _serialNumber, and serialNumber(). |
|
Definition at line 128 of file date.h. References _serialNumber, and serialNumber(). |
|
Definition at line 161 of file date.cpp. References advance(), and Integer. Referenced by mainconvertiblebond(). |
|
Definition at line 145 of file date.cpp. References advance(), Days, and Integer. Referenced by Drift::Drift(), asset::forwardPrice(), Exotics::getTheta(), inputBond(), inputBSOption(), inputButterflySpread(), inputCallSpread(), inputConvertibleBond(), inputPutSpread(), inputRatioCallSpread(), inputStraddle(), inputStrangle(), inputVanillaSwap(), mainasset(), RainbowOption::reassignVolsAtThemoney(), and RainbowOption::reassignVolsAtThestrike(). |
|
Definition at line 153 of file date.cpp. References advance(), Integer, and Months. Referenced by bond::getCashflow(), mainasset(), mainIRVanillaSwap(), and mainyieldcurve(). |
|
|
|
Definition at line 157 of file date.cpp. References advance(), Integer, and Years. Referenced by mainasset(), and mainIRVanillaSwap(). |
|
Definition at line 391 of file date.cpp. References applyConvention(), Date(), and serialNumber(). |
|
Definition at line 79 of file date.cpp. References _serialNumber, and LongInteger. Referenced by CashFlow::CashFlow(), dayCount(), Drift::Drift(), bond::fairvalue(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), returnDateConvention(), and SwapLeg::SwapLeg(). |
|
Set Date to system today's date.
Definition at line 91 of file date.cpp. References _serialNumber, Day, isLeap(), Month, monthLength(), monthOffset(), and yearOffset(). Referenced by CashFlow::CashFlow(), yieldCurve::discountFactor(), asset::forwardPrice(), yieldCurve::forwardRate(), Exotics::getTheta(), importData::importVolSurface(), inputBond(), inputBSOption(), inputButterflySpread(), inputCallSpread(), inputConvertibleBond(), inputPutSpread(), inputRainbowOption(), inputRatioCallSpread(), inputStraddle(), inputStrangle(), inputVanillaSwap(), mainasset(), mainconvertiblebond(), maindate(), mainIRVanillaSwap(), mainmc(), mainrainbowoptions(), mainyieldcurve(), RainbowOption::RainbowOption(), and yieldCurve::spotRate(). |
|
Return char* version of the date.
Definition at line 412 of file date.cpp. References dayOfMonth(), month(), and year(). Referenced by mainasset(), maindate(), mainvolsurface(), and operator<<(). |
|
Definition at line 48 of file date.cpp. References _serialNumber, Integer, and Weekday. Referenced by UsDate::isBusinessDay(), and nextWeekday(). |
|
Definition at line 72 of file date.cpp. References _serialNumber, Year, and yearOffset(). Referenced by advance(), dayCount(), dayOfMonth(), dayOfYear(), endOfMonth(), bond::fairvalue(), isEOM(), month(), and toString(). |
|
Definition at line 306 of file date.cpp. References LongInteger, and Year. Referenced by Date(), dayOfYear(), setDateToToday(), and year(). |
|
Definition at line 167 of file date.h. Referenced by applyConvention(), Date(), dayCount(), dayOfYear(), operator!=(), operator+(), operator++(), operator+=(), operator-(), operator--(), operator-=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), serialNumber(), setDateToToday(), weekday(), and year(). |