![]() |
semf
|
The Date
class provides date functions.
More...
#include <date.h>
Public Types | |
enum | Month { January = 1 , February , March , April , May , June , July , August , September , October , November , December } |
enum | Weekday { Sunday = 0 , Monday , Tuesday , Wednesday , Thursday , Friday , Saturday } |
Public Member Functions | |
Date ()=default | |
Date (uint8_t day, Month month, uint16_t year) | |
Constructor. More... | |
virtual | ~Date ()=default |
bool | setDate (uint8_t day, Month month, uint16_t year) |
Sets date information. More... | |
uint8_t | day () const |
Returns the day. More... | |
bool | setDay (uint8_t day) |
Sets a day. More... | |
Month | month () const |
Returns the month. More... | |
bool | setMonth (Month month) |
Sets a month. More... | |
uint16_t | year () const |
Returns the year. More... | |
bool | setYear (uint16_t year) |
Sets a year. More... | |
void | addDays (int32_t days) |
Adds days to this date. More... | |
Weekday | weekday () const |
Returns the day in the week of the actual Date . More... | |
void | addMonths (int32_t months) |
Adds months to this date. More... | |
void | addYears (int32_t years) |
Adds years to this date. More... | |
bool | operator== (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
bool | operator!= (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
bool | operator< (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
bool | operator<= (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
bool | operator> (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
bool | operator>= (const Date &dateToCompareWith) const |
Compares this date with other . More... | |
Static Protected Member Functions | |
static uint8_t | daysInMonth (Month month, uint16_t year) |
Returns the number of days in a specific month and year. More... | |
static bool | isLeapYear (uint16_t year) |
Returns if a specific year is a leap year or not. More... | |
static bool | isValid (uint8_t day, Month month, uint16_t year) |
Returns if the given date is valid. More... | |
The Date
class provides date functions.
A Date
object represents a particular date, i.e. a calendar date with year, month, and day numbers.
A Date
object is typically created by giving the year, month, and day numbers explicitly. An explicit date can also be set using setDate()
. The year()
, month()
, and day()
functions provide access to the year, month, and day numbers.
Date
provides a full set of operators to compare two Date objects where smaller means earlier, and larger means later.
Date
interprets year numbers less than 100 literally, i.e. as years 1 through 99, without adding any offset. enum semf::Date::Month |
enum semf::Date::Weekday |
|
default |
semf::Date::Date | ( | uint8_t | day, |
Month | month, | ||
uint16_t | year | ||
) |
|
virtualdefault |
void semf::Date::addDays | ( | int32_t | days | ) |
void semf::Date::addMonths | ( | int32_t | months | ) |
void semf::Date::addYears | ( | int32_t | years | ) |
uint8_t semf::Date::day | ( | ) | const |
|
staticprotected |
Returns the number of days in a specific month and year.
Returns "0" for invalid month and year setting.
month | Month to get the number of days from. |
year | Year in which the month is in. |
Definition at line 230 of file date.cpp.
|
staticprotected |
|
staticprotected |
Date::Month semf::Date::month | ( | ) | const |
bool semf::Date::operator!= | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::operator< | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::operator<= | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::operator== | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::operator> | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::operator>= | ( | const Date & | dateToCompareWith | ) | const |
bool semf::Date::setDate | ( | uint8_t | day, |
Month | month, | ||
uint16_t | year | ||
) |
bool semf::Date::setDay | ( | uint8_t | day | ) |
bool semf::Date::setMonth | ( | Month | month | ) |
bool semf::Date::setYear | ( | uint16_t | year | ) |
Date::Weekday semf::Date::weekday | ( | ) | const |