5 #include <Bpp/Text/TextTools.h> 15 Date::Date(
const int day,
const int month,
const int year) : day_(day),
19 if (day < 1 || day > 31)
20 throw (BadIntegerException(
"Date::Date: day must be in [1;31].", day));
21 if (month < 1 || month > 12)
22 throw (BadIntegerException(
"Date::Date: month must be in [1;12].", month));
45 if (day >= 1 && day <= 31)
48 throw (BadIntegerException(
"Date::Date: day must be in [1;31].", day));
49 if (month >= 1 && month <= 12)
52 throw (BadIntegerException(
"Date::Date: month must be in [1;12].", month));
63 if (month >= 1 && month <= 12)
66 throw (BadIntegerException(
"Date::Date: month must be in [1;12].", month));
71 if (day >= 1 && day <= 31)
74 throw (BadIntegerException(
"Date::Date: day must be in [1;31].", day));
79 string date, uDay =
"", uMonth =
"";
84 date = uDay + TextTools::toString(
day_) + uMonth + TextTools::toString(
month_) + TextTools::toString(
year_);
void setDate(const int day, const int month, const int year)
Set the Date.
Date & operator=(const Date &date)
The Date copy operator.
void setMonth(const int month)
Set the month.
int getDay() const
Get the day as an int.
~Date()
Destroy the Date object.
void setYear(const int year)
Set the year.
int getMonth() const
Get the month as an int.
void setDay(const int day)
Set the day.
std::string getDateStr() const
Get the Date as a string.
int getYear() const
Get the Year as an int.
Date(const int day=1, const int month=1, const int year=2000)
Build a new Date from three values.
bool operator==(const Date &date) const
The == operator.
bool operator<(const Date &date) const
The < operator.