Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

QuantLib::Date Class Reference

#include <date.hpp>

List of all members.


Detailed Description

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).

Test:
self-consistency of dates, serial numbers, days of month, months, and weekdays is checked over the whole date range.

Definition at line 89 of file date.hpp.


Public Member Functions

constructors
 Date (Day d, Month m, Year y)
 More traditional constructor.
 Date (BigInteger serialNumber)
 Constructor taking a serial number as given by Applix or Excel.
 Date ()
 Default constructor returning a null date.
inspectors
Day dayOfMonth () const
Day dayOfYear () const
 One-based (Jan 1st = 1).
Month month () const
BigInteger serialNumber () const
Weekday weekday () const
Year year () const
date algebra
Date operator+ (const Period &) const
 returns a new date incremented by the given period
Date operator+ (BigInteger days) const
 returns a new date incremented by the given number of days
Date operator++ (int)
 1-day post-increment
Dateoperator++ ()
 1-day pre-increment
Dateoperator+= (const Period &)
 increments date by the given period
Dateoperator+= (BigInteger days)
 increments date by the given number of days
Date operator- (const Period &) const
 returns a new date decremented by the given period
Date operator- (BigInteger days) const
 returns a new date decremented by the given number of days
Date operator-- (int)
 1-day post-decrement
Dateoperator-- ()
 1-day pre-decrement
Dateoperator-= (const Period &)
 decrements date by the given period
Dateoperator-= (BigInteger days)
 decrement date by the given number of days

Static Public Member Functions

static methods
static Date endOfMonth (const Date &d)
 last day of the month to which the given date belongs
static bool isEndOfMonth (const Date &d)
 whether a date is the last day of its month
static bool isLeap (Year y)
 whether the given year is a leap one
static Date maxDate ()
 latest allowed date
static Date minDate ()
 earliest allowed date
static Date nextWeekday (const Date &d, Weekday w)
 next given weekday following or equal to the given date
static Date nthWeekday (Size n, Weekday w, Month m, Year y)
 n-th given weekday in the given month and year
static Date todaysDate ()
 today's date.

Static Private Member Functions

static Date advance (const Date &d, Integer units, TimeUnit)
static void checkSerialNumber (BigInteger serialNumber)
static BigInteger maximumSerialNumber ()
static BigInteger minimumSerialNumber ()
static Integer monthLength (Month m, bool leapYear)
static Integer monthOffset (Month m, bool leapYear)
static BigInteger yearOffset (Year y)

Private Attributes

BigInteger serialNumber_

Related Functions

(Note that these are not member functions.)

bool operator!= (const Date &, const Date &)
BigInteger operator- (const Date &, const Date &)
 Difference in days between dates.
bool operator< (const Date &, const Date &)
std::ostream & operator<< (std::ostream &, 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 &)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index