Simple++
Powerfull and lightning fast C++ Library
Public Member Functions | Static Public Member Functions | List of all members
Time::Date Class Reference

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 >
Dateoperator+= (const Duration< ratio > &duration)
 
template<typename ratio >
Dateoperator-= (const Duration< ratio > &duration)
 
Dateoperator+= (TimeT timeT)
 
Dateoperator-= (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)
 
Dateoperator= (const Date &date)
 
Dateoperator= (const tm &date)
 
Dateoperator= (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 ()
 

Detailed Description

Class representing a date in the time (day/month/year hour etc...)

Constructor & Destructor Documentation

Time::Date::Date ( )

Empty constructor, not initialized, use Time::getDate() to get the current date.

Time::Date::Date ( const Date date)

copy constructor

Parameters
dateOther date to copy
Time::Date::Date ( const tm &  date)

Constructor from a struct tm.

Parameters
dateDate to copy
Time::Date::Date ( const TimePoint timePoint)

Constructor from a time point.

Parameters
timePointTime point to use
Time::Date::~Date ( )

Member Function Documentation

unsigned char Time::Date::getDay ( ) const

get the day of the month of this date

Returns
day of the month [1-31]
unsigned char Time::Date::getHours ( ) const

get the hours of this date

Returns
hours [0-23]
const long long Time::Date::getLocalUTCBias ( )
static
Parameters
getthe local time bias in seconds
Returns
local time bias
unsigned char Time::Date::getMinutes ( ) const

get the minutes of this date

Returns
minutes [0-59]
unsigned char Time::Date::getMonth ( ) const

get the month of this date

Returns
Month [0-11]
template<typename T >
const BasicString< T > & Time::Date::getMonthStr ( unsigned char  month)
static

get the month English name from the month number

Parameters
monthnumber [0-11]
Returns
Month name as a String<T>
const unsigned int Time::Date::getNumDays ( int  year)
static

get the number of day in a specified year

Parameters
yearYear
Returns
number of day of the year
unsigned char Time::Date::getSeconds ( ) const

get the seconds of this date

Returns
seconds [0-59]
unsigned char Time::Date::getWeekDay ( const Date date)
static

get the day number of the week (Monday is the first one)

Returns
day number of the week [0-6]
const unsigned char Time::Date::getWeekDay ( unsigned char  day,
unsigned char  month,
int  year 
)
static

compute the day number of the week from a day number of the month, a month and a year

Parameters
dayday number of the month [1-31]
monthmonth number [0-11]
yearyear
Returns
day number of the week
template<typename T >
const BasicString< T > & Time::Date::getWeekDayStr ( unsigned char  weekDay)
static

get the week day English name from the day number of the week.

Parameters
weekDayDay number of the week [0-6]
Returns
Weekday name as a String<T>
int Time::Date::getYear ( ) const

get the year of this date

Returns
year
const bool Time::Date::isYearLeapYear ( int  year)
static

compute if a year is a leap one

Parameters
yearYear to be used
Returns
True of the year is a leap one, false instead.
bool Time::Date::operator!= ( const Date d)
template<typename ratio >
Date & Time::Date::operator+= ( const Duration< ratio > &  duration)
Date & Time::Date::operator+= ( TimeT  timeT)
template<typename ratio >
Date & Time::Date::operator-= ( const Duration< ratio > &  duration)
Date & Time::Date::operator-= ( TimeT  timeT)
bool Time::Date::operator< ( const Date d)
bool Time::Date::operator<= ( const Date d)
Date & Time::Date::operator= ( const Date date)
Date & Time::Date::operator= ( const tm &  date)
Date & Time::Date::operator= ( const TimePoint timePoint)
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

Parameters
dday of the month [1-31]
void Time::Date::setHours ( unsigned char  h)

set the hours of this date

Parameters
hhours [0-23]
void Time::Date::setMinutes ( unsigned char  m)

set the minutes of this date

Parameters
mminutes [0-59]
void Time::Date::setMonth ( unsigned char  m)

set the month of this date

Parameters
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

Parameters
sseconds [0-59]
void Time::Date::setYear ( int  y)

set the year of this date

Parameters
year
template<typename T >
BasicString< T > Time::Date::toString ( ) const

Create an human readable string of this date with a default template "<WeekDay> <MonthName> <DayNumber> <Hour>:<Minutes>:<Seconds>".

Returns
Human readable string of this date
template<typename T >
BasicString< T > Time::Date::toString ( const BasicString< T > &  str) const

Create an human readable string of this date using a specified template.

Parameters
strtemplate 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)
TimePoint Time::Date::toTimePoint ( ) const

convert this date to a TimePoint


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