Simple++
Powerfull and lightning fast C++ Library
|
Class representing a date in the time (day/month/year hour etc...) More...
#include <Date.h>
Public Member Functions | |
Date () | |
Empty constructor, not initialized, use Time::getDate() to get the current date. More... | |
Date (const Date &date) | |
copy constructor More... | |
Date (const tm &date) | |
Constructor from a struct tm. More... | |
Date (const TimePoint &timePoint) | |
Constructor from a time point. More... | |
template<typename ratio > | |
Date & | operator+= (const Duration< ratio > &duration) |
template<typename ratio > | |
Date & | operator-= (const Duration< ratio > &duration) |
Date & | operator+= (TimeT timeT) |
Date & | operator-= (TimeT timeT) |
bool | operator== (const Date &d) |
bool | operator!= (const Date &d) |
bool | operator< (const Date &d) |
bool | operator> (const Date &d) |
bool | operator>= (const Date &d) |
bool | operator<= (const Date &d) |
Date & | operator= (const Date &date) |
Date & | operator= (const tm &date) |
Date & | operator= (const TimePoint &timePoint) |
unsigned char | getSeconds () const |
get the seconds of this date More... | |
unsigned char | getMinutes () const |
get the minutes of this date More... | |
unsigned char | getHours () const |
get the hours of this date More... | |
unsigned char | getDay () const |
get the day of the month of this date More... | |
unsigned char | getMonth () const |
get the month of this date More... | |
int | getYear () const |
get the year of this date More... | |
void | setNow () |
set the date to now More... | |
void | setSeconds (unsigned char s) |
set the seconds of this date More... | |
void | setMinutes (unsigned char m) |
set the minutes of this date More... | |
void | setHours (unsigned char h) |
set the hours of this date More... | |
void | setDay (unsigned char d) |
set the day of this date More... | |
void | setMonth (unsigned char m) |
set the month of this date More... | |
void | setYear (int y) |
set the year of this date More... | |
template<typename T = char> | |
BasicString< T > | toString () const |
Create an human readable string of this date with a default template "<WeekDay> <MonthName> <DayNumber> <Hour>:<Minutes>:<Seconds>". More... | |
template<typename T = char> | |
BasicString< T > | toString (const BasicString< T > &str) const |
Create an human readable string of this date using a specified template. More... | |
TimePoint | toTimePoint () const |
convert this date to a TimePoint More... | |
~Date () | |
Static Public Member Functions | |
static unsigned char | getWeekDay (const Date &date) |
get the day number of the week (Monday is the first one) More... | |
static const bool | isYearLeapYear (int year) |
compute if a year is a leap one More... | |
static const unsigned char | getWeekDay (unsigned char day, unsigned char month, int year) |
compute the day number of the week from a day number of the month, a month and a year More... | |
template<typename T = char> | |
static const BasicString< T > & | getWeekDayStr (unsigned char weekDay) |
get the week day English name from the day number of the week. More... | |
template<typename T = char> | |
static const BasicString< T > & | getMonthStr (unsigned char month) |
get the month English name from the month number More... | |
static const unsigned int | getNumDays (int year) |
get the number of day in a specified year More... | |
static const long long | getLocalUTCBias () |
Class representing a date in the time (day/month/year hour etc...)
Time::Date::Date | ( | ) |
Empty constructor, not initialized, use Time::getDate() to get the current date.
Time::Date::Date | ( | const Date & | date | ) |
copy constructor
date | Other date to copy |
Time::Date::Date | ( | const tm & | date | ) |
Constructor from a struct tm.
date | Date to copy |
Time::Date::Date | ( | const TimePoint & | timePoint | ) |
Constructor from a time point.
timePoint | Time point to use |
Time::Date::~Date | ( | ) |
unsigned char Time::Date::getDay | ( | ) | const |
get the day of the month of this date
unsigned char Time::Date::getHours | ( | ) | const |
get the hours of this date
|
static |
get | the local time bias in seconds |
unsigned char Time::Date::getMinutes | ( | ) | const |
get the minutes of this date
unsigned char Time::Date::getMonth | ( | ) | const |
get the month of this date
|
static |
get the month English name from the month number
month | number [0-11] |
|
static |
get the number of day in a specified year
year | Year |
unsigned char Time::Date::getSeconds | ( | ) | const |
get the seconds of this date
|
static |
get the day number of the week (Monday is the first one)
|
static |
compute the day number of the week from a day number of the month, a month and a year
day | day number of the month [1-31] |
month | month number [0-11] |
year | year |
|
static |
get the week day English name from the day number of the week.
weekDay | Day number of the week [0-6] |
int Time::Date::getYear | ( | ) | const |
get the year of this date
|
static |
compute if a year is a leap one
year | Year to be used |
bool Time::Date::operator!= | ( | const Date & | d | ) |
bool Time::Date::operator< | ( | const Date & | d | ) |
bool Time::Date::operator<= | ( | const Date & | d | ) |
Date & Time::Date::operator= | ( | const tm & | date | ) |
bool Time::Date::operator== | ( | const Date & | d | ) |
bool Time::Date::operator> | ( | const Date & | d | ) |
bool Time::Date::operator>= | ( | const Date & | d | ) |
void Time::Date::setDay | ( | unsigned char | d | ) |
set the day of this date
d | day of the month [1-31] |
void Time::Date::setHours | ( | unsigned char | h | ) |
set the hours of this date
h | hours [0-23] |
void Time::Date::setMinutes | ( | unsigned char | m | ) |
set the minutes of this date
m | minutes [0-59] |
void Time::Date::setMonth | ( | unsigned char | m | ) |
set the month of this date
month | [0-11] |
void Time::Date::setNow | ( | ) |
set the date to now
void Time::Date::setSeconds | ( | unsigned char | s | ) |
set the seconds of this date
s | seconds [0-59] |
void Time::Date::setYear | ( | int | y | ) |
set the year of this date
year |
BasicString< T > Time::Date::toString | ( | ) | const |
Create an human readable string of this date with a default template "<WeekDay> <MonthName> <DayNumber> <Hour>:<Minutes>:<Seconds>".
BasicString< T > Time::Date::toString | ( | const BasicString< T > & | str | ) | const |
Create an human readable string of this date using a specified template.
str | template to be used. Available symbols to be used : Y : Year (four digits) y : Year (two last digits) b : Month Name m : Month number d : Day Number of the month (With zeros) e : Day number of the month (Without zeros) a : Week Day Name u : Day number of the week H : Hours (with zeros) M : Minutes (with zeros) S : Seconds (with zeros) |