This class provides Date operations.
Definition at line 64 of file chrono.h.
OSB_LIB::Date::Date | ( | ) | [inline] |
OSB_LIB::Date::Date | ( | int | dd, | |
Month | mm, | |||
int | yy | |||
) |
Constructor with day, month and year.
dd | Day of month. | |
mm | Month. | |
yy | Year. |
OSB_LIB::Date::Date | ( | const std::string & | src, | |
const std::string & | format = "%d-%m-%Y" | |||
) | [explicit] |
Construct from string.
src | String representing the date in format. | |
format | Describes the format of src: "%d-%m-%Y" corresponds to "dd-mm-yyyy", see man strptime for details. |
Constructor with year, month, week and weekday.
dd | Day of the week. | |
ww | Week of the month, see below. | |
mm | Month. | |
yy | Year. |
"The day of week ww of month mm of the year (1 < ww < 5, 1 < mm < 12). When ww is 5, it refers to the last dd day of month mm which may occur in either the fourth or fifth week. Week 1 is the first week in which the day dd occurs."
OSB_LIB::Date::Date | ( | long | days | ) | [inline, explicit, private] |
Date& OSB_LIB::Date::addMonths | ( | int | n | ) |
Add n months.
Date& OSB_LIB::Date::addYears | ( | int | n | ) |
Add n years.
int OSB_LIB::Date::day | ( | ) | const |
Returns day of month.
Weekday OSB_LIB::Date::dayOfWeek | ( | ) | const |
The day of the week: returns 1 (Monday) to 7 (Sunday).
int OSB_LIB::Date::dayOfYear | ( | ) | const |
Returns 1 to 365 or 366.
void OSB_LIB::Date::dmy2j | ( | int | dd, | |
Month | mm, | |||
int | yy | |||
) | [private] |
Set j from day, month, year.
void OSB_LIB::Date::getDmy | ( | int & | day, | |
Month & | mon, | |||
int & | year | |||
) | const [inline] |
bool OSB_LIB::Date::isSet | ( | ) | const [inline] |
Date set?
Definition at line 671 of file chrono.h.
References notSet().
Referenced by OSB_LIB::DateTime::isSet().
void OSB_LIB::Date::j2dmy | ( | int & | dd, | |
Month & | mm, | |||
int & | yy | |||
) | const [private] |
const Date OSB_LIB::Date::max | ( | ) | [inline, static] |
Largest date.
Larger dates are possible, with restrictions.
Definition at line 661 of file chrono.h.
References Date(), and maxDay_.
Referenced by OSB_LIB::BsPage::endDate(), and OSB_LIB::DateTime::max().
const Date OSB_LIB::Date::min | ( | ) | [inline, static] |
Smallest date.
Smaller dates are possible, however note that the day before the minimum date is considered not set.
Definition at line 656 of file chrono.h.
References Date(), and minDay_.
Referenced by OSB_LIB::DateTime::min().
Month OSB_LIB::Date::month | ( | ) | const |
Returns month.
bool OSB_LIB::Date::notSet | ( | ) | const [inline] |
bool OSB_LIB::Date::operator!= | ( | const Date & | b | ) | const [inline] |
bool OSB_LIB::Date::operator< | ( | const Date & | b | ) | const [inline] |
bool OSB_LIB::Date::operator<= | ( | const Date & | b | ) | const [inline] |
bool OSB_LIB::Date::operator== | ( | const Date & | b | ) | const [inline] |
bool OSB_LIB::Date::operator> | ( | const Date & | b | ) | const [inline] |
bool OSB_LIB::Date::operator>= | ( | const Date & | b | ) | const [inline] |
std::string OSB_LIB::Date::str | ( | const std::string & | format = "%d-%m-%Y" |
) | const |
Function to return date using a specific format.
This function will returns a date with the format in the parameter.
For more details about the format please look at standard C-function "strftime".
format | Date format for the return value. The default yields "dd-mm-yyyy", see man strftime for details. |
Referenced by OSB_LIB::operator<<().
static Date OSB_LIB::Date::today | ( | ) | [static] |
Current date.
int OSB_LIB::Date::year | ( | ) | const |
Returns year.
const int OSB_LIB::Date::baseYear_ [static, private] |
const int OSB_LIB::Date::daytab_[2][13] [static] |
Number of days per month.
The first row is for non-leap years, the second for leap years,
the days of each month is stored in the column (daytab_[][0] is not relevant).
Definition at line 74 of file chrono.h.
Referenced by OSB_LIB::lastDay().
long OSB_LIB::Date::j_ [private] |
Days from 1/1 of the base year.
A value of 1 corresponds to January 1 of the base year.
Definition at line 243 of file chrono.h.
Referenced by addDays(), notSet(), operator!=(), operator-(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
const int OSB_LIB::Date::maxDay_ [static, private] |
const int OSB_LIB::Date::minDay_ [static, private] |
const int OSB_LIB::Date::monday_ [static, private] |