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 (long 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 |
bool | isEndOfMonth () const |
Day | lastDayOfMonth () const |
Day | dayOfYear () const |
| One-based (Jan 1st = 1).
|
Month | month () const |
Year | year () const |
long | serialNumber () const |
|
Date & | operator+= (int days) |
| increments date in place
|
Date & | operator-= (int days) |
| decrement date in place
|
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+ (int days) const |
| returns a new incremented date
|
Date | operator- (int days) const |
| returns a new decremented date
|
|
Date | plusDays (int days) const |
Date | plusWeeks (int weeks) const |
Date | plusMonths (int months) const |
Date | plusYears (int years) const |
Date | plus (int units, TimeUnit) const |
Date | plus (const Period &) const |
Static Public Member Functions |
|
bool | isLeap (Year y) |
Date | minDate () |
| earliest allowed date
|
Date | maxDate () |
| latest allowed date
|
Date | todaysDate () |
| today's date.
|
Related Functions |
(Note that these are not member functions.)
|
std::ostream & | operator<< (std::ostream &, const Date &) |
long | 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 &) |