this class represents a date time and allows to perform various operation according to the locale settings. More...
#include <date_time.hpp>
Public Member Functions | |
date_time () | |
Dafault constructor, uses default calendar initialized date_time object to current time. More... | |
date_time (date_time const &other) | |
copy date_time More... | |
date_time (date_time const &other, date_time_period_set const &set) | |
copy date_time and change some fields according to the set More... | |
date_time const & | operator= (date_time const &other) |
assign the date_time More... | |
~date_time () | |
date_time (double time) | |
Create a date_time object using POSIX time time and default calendar. More... | |
date_time (double time, calendar const &cal) | |
Create a date_time object using POSIX time time and calendar cal. More... | |
date_time (calendar const &cal) | |
Create a date_time object using calendar cal and initializes it to current time. More... | |
date_time (date_time_period_set const &set) | |
Create a date_time object using default calendar and define values given in set. More... | |
date_time (date_time_period_set const &set, calendar const &cal) | |
Create a date_time object using calendar cal and define values given in set. More... | |
date_time const & | operator= (date_time_period_set const &f) |
assign values to various periods in set f More... | |
void | set (period::period_type f, int v) |
set specific period f value to v More... | |
int | get (period::period_type f) const |
get specific period f value More... | |
int | operator/ (period::period_type f) const |
syntactic sugar for get(f) More... | |
date_time | operator+ (period::period_type f) const |
add single period f to the current date_time More... | |
date_time | operator- (period::period_type f) const |
subtract single period f from the current date_time More... | |
date_time const & | operator+= (period::period_type f) |
add single period f to the current date_time More... | |
date_time const & | operator-= (period::period_type f) |
subtract single period f from the current date_time More... | |
date_time | operator<< (period::period_type f) const |
roll forward a date by single period f. More... | |
date_time | operator>> (period::period_type f) const |
roll backward a date by single period f. More... | |
date_time const & | operator<<= (period::period_type f) |
roll forward a date by single period f. More... | |
date_time const & | operator>>= (period::period_type f) |
roll backward a date by single period f. More... | |
date_time | operator+ (date_time_period const &v) const |
add date_time_period to the current date_time More... | |
date_time | operator- (date_time_period const &v) const |
subtract date_time_period from the current date_time More... | |
date_time const & | operator+= (date_time_period const &v) |
add date_time_period to the current date_time More... | |
date_time const & | operator-= (date_time_period const &v) |
subtract date_time_period from the current date_time More... | |
date_time | operator<< (date_time_period const &v) const |
roll current date_time forward by date_time_period v More... | |
date_time | operator>> (date_time_period const &v) const |
roll current date_time backward by date_time_period v More... | |
date_time const & | operator<<= (date_time_period const &v) |
roll current date_time forward by date_time_period v More... | |
date_time const & | operator>>= (date_time_period const &v) |
roll current date_time backward by date_time_period v More... | |
date_time | operator+ (date_time_period_set const &v) const |
add date_time_period_set v to the current date_time More... | |
date_time | operator- (date_time_period_set const &v) const |
subtract date_time_period_set v from the current date_time More... | |
date_time const & | operator+= (date_time_period_set const &v) |
add date_time_period_set v to the current date_time More... | |
date_time const & | operator-= (date_time_period_set const &v) |
subtract date_time_period_set v from the current date_time More... | |
date_time | operator<< (date_time_period_set const &v) const |
roll current date_time forward by date_time_period_set v More... | |
date_time | operator>> (date_time_period_set const &v) const |
roll current date_time backward by date_time_period_set v More... | |
date_time const & | operator<<= (date_time_period_set const &v) |
roll current date_time forward by date_time_period_set v More... | |
date_time const & | operator>>= (date_time_period_set const &v) |
roll current date_time backward by date_time_period_set v More... | |
double | time () const |
Get POSIX time. More... | |
void | time (double v) |
set POSIX time More... | |
bool | operator== (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
bool | operator!= (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
bool | operator< (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
bool | operator> (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
bool | operator<= (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
bool | operator>= (date_time const &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) More... | |
void | swap (date_time &other) |
swaps two dates - efficient, does not throw More... | |
int | difference (date_time const &other, period::period_type f) const |
calculate the distance from this date_time to other in terms of perios f More... | |
int | minimum (period::period_type f) const |
Get minimal possible value for *this time point for a period f. More... | |
int | maximum (period::period_type f) const |
Get minimal possible value for *this time point for a period f. More... | |
bool | is_in_daylight_saving_time () const |
Check if *this time point is in daylight saving time. More... | |
this class represents a date time and allows to perform various operation according to the locale settings.
This class allows to manipulate various aspects of dates and times easily using arithmetic operations with periods.
General arithmetic functions:
You can also assign specific periods using assignment operator like: some_time = year * 1995 that sets the year to 1995.
boost::locale::date_time::date_time | ( | ) |
Dafault constructor, uses default calendar initialized date_time object to current time.
boost::locale::date_time::date_time | ( | date_time const & | other, |
date_time_period_set const & | set | ||
) |
copy date_time and change some fields according to the set
boost::locale::date_time::~date_time | ( | ) |
boost::locale::date_time::date_time | ( | double | time | ) |
Create a date_time object using POSIX time time and default calendar.
boost::locale::date_time::date_time | ( | double | time, |
calendar const & | cal | ||
) |
Create a date_time object using POSIX time time and calendar cal.
boost::locale::date_time::date_time | ( | calendar const & | cal | ) |
Create a date_time object using calendar cal and initializes it to current time.
boost::locale::date_time::date_time | ( | date_time_period_set const & | set | ) |
Create a date_time object using default calendar and define values given in set.
boost::locale::date_time::date_time | ( | date_time_period_set const & | set, |
calendar const & | cal | ||
) |
Create a date_time object using calendar cal and define values given in set.
int boost::locale::date_time::difference | ( | date_time const & | other, |
period::period_type | f | ||
) | const |
calculate the distance from this date_time to other in terms of perios f
Referenced by boost::locale::date_time_duration::get(), and boost::locale::date_time_duration::operator/().
int boost::locale::date_time::get | ( | period::period_type | f | ) | const |
get specific period f value
Referenced by boost::locale::period::am_pm(), boost::locale::period::day(), boost::locale::period::day_of_week(), boost::locale::period::day_of_week_in_month(), boost::locale::period::day_of_week_local(), boost::locale::period::day_of_year(), boost::locale::period::era(), boost::locale::period::extended_year(), boost::locale::period::first_day_of_week(), boost::locale::period::hour(), boost::locale::period::hour_12(), boost::locale::period::minute(), boost::locale::period::month(), boost::locale::period::second(), boost::locale::period::week_of_month(), boost::locale::period::week_of_year(), and boost::locale::period::year().
bool boost::locale::date_time::is_in_daylight_saving_time | ( | ) | const |
Check if *this time point is in daylight saving time.
int boost::locale::date_time::maximum | ( | period::period_type | f | ) | const |
Get minimal possible value for *this time point for a period f.
For example in February maximum(day) may be 28 or 29, in January maximum(day)==31
int boost::locale::date_time::minimum | ( | period::period_type | f | ) | const |
Get minimal possible value for *this time point for a period f.
bool boost::locale::date_time::operator!= | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
|
inline |
add single period f to the current date_time
date_time boost::locale::date_time::operator+ | ( | date_time_period const & | v | ) | const |
add date_time_period to the current date_time
date_time boost::locale::date_time::operator+ | ( | date_time_period_set const & | v | ) | const |
add date_time_period_set v to the current date_time
|
inline |
add single period f to the current date_time
date_time const& boost::locale::date_time::operator+= | ( | date_time_period const & | v | ) |
add date_time_period to the current date_time
date_time const& boost::locale::date_time::operator+= | ( | date_time_period_set const & | v | ) |
add date_time_period_set v to the current date_time
|
inline |
subtract single period f from the current date_time
date_time boost::locale::date_time::operator- | ( | date_time_period const & | v | ) | const |
subtract date_time_period from the current date_time
date_time boost::locale::date_time::operator- | ( | date_time_period_set const & | v | ) | const |
subtract date_time_period_set v from the current date_time
|
inline |
subtract single period f from the current date_time
date_time const& boost::locale::date_time::operator-= | ( | date_time_period const & | v | ) |
subtract date_time_period from the current date_time
date_time const& boost::locale::date_time::operator-= | ( | date_time_period_set const & | v | ) |
subtract date_time_period_set v from the current date_time
|
inline |
syntactic sugar for get(f)
bool boost::locale::date_time::operator< | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
|
inline |
roll forward a date by single period f.
date_time boost::locale::date_time::operator<< | ( | date_time_period const & | v | ) | const |
roll current date_time forward by date_time_period v
date_time boost::locale::date_time::operator<< | ( | date_time_period_set const & | v | ) | const |
roll current date_time forward by date_time_period_set v
|
inline |
roll forward a date by single period f.
date_time const& boost::locale::date_time::operator<<= | ( | date_time_period const & | v | ) |
roll current date_time forward by date_time_period v
date_time const& boost::locale::date_time::operator<<= | ( | date_time_period_set const & | v | ) |
roll current date_time forward by date_time_period_set v
bool boost::locale::date_time::operator<= | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
assign the date_time
date_time const& boost::locale::date_time::operator= | ( | date_time_period_set const & | f | ) |
assign values to various periods in set f
bool boost::locale::date_time::operator== | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
bool boost::locale::date_time::operator> | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
bool boost::locale::date_time::operator>= | ( | date_time const & | other | ) | const |
compare date_time in the timeline (ignores difference in calendar, timezone etc)
|
inline |
roll backward a date by single period f.
date_time boost::locale::date_time::operator>> | ( | date_time_period const & | v | ) | const |
roll current date_time backward by date_time_period v
date_time boost::locale::date_time::operator>> | ( | date_time_period_set const & | v | ) | const |
roll current date_time backward by date_time_period_set v
|
inline |
roll backward a date by single period f.
date_time const& boost::locale::date_time::operator>>= | ( | date_time_period const & | v | ) |
roll current date_time backward by date_time_period v
date_time const& boost::locale::date_time::operator>>= | ( | date_time_period_set const & | v | ) |
roll current date_time backward by date_time_period_set v
void boost::locale::date_time::set | ( | period::period_type | f, |
int | v | ||
) |
set specific period f value to v
void boost::locale::date_time::swap | ( | date_time & | other | ) |
swaps two dates - efficient, does not throw
double boost::locale::date_time::time | ( | ) | const |
Get POSIX time.
The POSIX time is number of seconds since January 1st, 1970 00:00 UTC, ignoring leap seconds.
Referenced by boost::locale::operator>>().
void boost::locale::date_time::time | ( | double | v | ) |
set POSIX time
The POSIX time is number of seconds since January 1st, 1970 00:00 UTC, ignoring leap seconds. This time can be fetched from Operating system clock using C function time, gettimeofday and others.