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).
|
Public Member Functions |
|
| Date () |
| Default constructor returning a null date.
|
| Date (BigInteger serialNumber) |
| Constructor taking a serial number as given by Applix or Excel.
|
| Date (Day d, Month m, Year y) |
| More traditional constructor.
|
|
Weekday | weekday () const |
Day | dayOfMonth () const |
Day | dayOfYear () const |
| One-based (Jan 1st = 1).
|
Month | month () const |
Year | year () const |
BigInteger | serialNumber () const |
bool | isEndOfMonth () const |
Day | lastDayOfMonth () const |
|
Date & | operator+= (BigInteger days) |
| increments date by the given number of days
|
Date & | operator+= (const Period &) |
| increments date by the given period
|
Date & | operator-= (BigInteger days) |
| decrement date by the given number of days
|
Date & | operator-= (const Period &) |
| decrements date by the given period
|
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+ (BigInteger days) const |
| returns a new date incremented by the given number of days
|
Date | operator+ (const Period &) const |
| returns a new date incremented by the given period
|
Date | operator- (BigInteger days) const |
| returns a new date decremented by the given number of days
|
Date | operator- (const Period &) const |
| returns a new date decremented by the given period
|
|
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 |
Date | plus (const Period &) const |
Static Public Member Functions |
|
Date | todaysDate () |
| today's date.
|
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 (Size n, Weekday, Month m, Year y) |
| n-th given weekday in the given month and year
|
bool | isIMMdate (const Date &d) |
| whether or not the given date is an IMM date
|
Date | nextIMMdate (const Date &d) |
| next IMM date following (or equal to) the given date
|
Related Functions |
(Note that these are not member functions.)
|
std::ostream & | operator<< (std::ostream &, const Date &) |
BigInteger | operator- (const Date &, const Date &) |
| Difference in days between dates.
|
bool | operator== (const Date &, const Date &) |
bool | operator!= (const Date &, const Date &) |
bool | operator< (const Date &, const Date &) |
bool | operator<= (const Date &, const Date &) |
bool | operator> (const Date &, const Date &) |
bool | operator>= (const Date &, const Date &) |