Boost.Locale
|
this class represents a date time and allows to perform various operation according to the locale settings. More...
#include <boost/locale/date_time.hpp>
Public Member Functions | |
date_time () | |
date_time (const date_time &other) | |
Copy a date_time. | |
date_time (date_time &&) noexcept=default | |
date_time (const date_time &other, const date_time_period_set &set) | |
copy date_time and change some fields according to the set | |
date_time & | operator= (const date_time &other) |
assign the date_time | |
date_time & | operator= (date_time &&) noexcept=default |
date_time (double time) | |
date_time (double time, const calendar &cal) | |
Create a date_time object using POSIX time time and calendar cal. | |
date_time (const calendar &cal) | |
Create a date_time object using calendar cal and initializes it to current time. | |
date_time (const date_time_period_set &set) | |
date_time (const date_time_period_set &set, const calendar &cal) | |
Create a date_time object using calendar cal and define values given in set. | |
date_time & | operator= (const date_time_period_set &f) |
assign values to various periods in set f | |
void | set (period::period_type f, int v) |
set specific period f value to v | |
int | get (period::period_type f) const |
get specific period f value | |
int | operator/ (period::period_type f) const |
syntactic sugar for get(f) | |
date_time | operator+ (period::period_type f) const |
add single period f to the current date_time | |
date_time | operator- (period::period_type f) const |
subtract single period f from the current date_time | |
date_time & | operator+= (period::period_type f) |
add single period f to the current date_time | |
date_time & | operator-= (period::period_type f) |
subtract single period f from the current date_time | |
date_time | operator<< (period::period_type f) const |
roll forward a date by single period f. | |
date_time | operator>> (period::period_type f) const |
roll backward a date by single period f. | |
date_time & | operator<<= (period::period_type f) |
roll forward a date by single period f. | |
date_time & | operator>>= (period::period_type f) |
roll backward a date by single period f. | |
date_time | operator+ (const date_time_period &v) const |
add date_time_period to the current date_time | |
date_time | operator- (const date_time_period &v) const |
subtract date_time_period from the current date_time | |
date_time & | operator+= (const date_time_period &v) |
add date_time_period to the current date_time | |
date_time & | operator-= (const date_time_period &v) |
subtract date_time_period from the current date_time | |
date_time | operator<< (const date_time_period &v) const |
roll current date_time forward by date_time_period v | |
date_time | operator>> (const date_time_period &v) const |
roll current date_time backward by date_time_period v | |
date_time & | operator<<= (const date_time_period &v) |
roll current date_time forward by date_time_period v | |
date_time & | operator>>= (const date_time_period &v) |
roll current date_time backward by date_time_period v | |
date_time | operator+ (const date_time_period_set &v) const |
add date_time_period_set v to the current date_time | |
date_time | operator- (const date_time_period_set &v) const |
subtract date_time_period_set v from the current date_time | |
date_time & | operator+= (const date_time_period_set &v) |
add date_time_period_set v to the current date_time | |
date_time & | operator-= (const date_time_period_set &v) |
subtract date_time_period_set v from the current date_time | |
date_time | operator<< (const date_time_period_set &v) const |
roll current date_time forward by date_time_period_set v | |
date_time | operator>> (const date_time_period_set &v) const |
roll current date_time backward by date_time_period_set v | |
date_time & | operator<<= (const date_time_period_set &v) |
roll current date_time forward by date_time_period_set v | |
date_time & | operator>>= (const date_time_period_set &v) |
roll current date_time backward by date_time_period_set v | |
double | time () const |
void | time (double v) |
std::string | timezone () const |
Get the name of the associated timezone. | |
bool | operator== (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
bool | operator!= (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
bool | operator< (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
bool | operator> (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
bool | operator<= (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
bool | operator>= (const date_time &other) const |
compare date_time in the timeline (ignores difference in calendar, timezone etc) | |
void | swap (date_time &other) noexcept |
swaps two dates - efficient, does not throw | |
int | difference (const date_time &other, period::period_type f) const |
calculate the distance from this date_time to other in terms of periods f | |
int | minimum (period::period_type f) const |
Get minimal possible value for *this time point for a period f. | |
int | maximum (period::period_type f) const |
bool | is_in_daylight_saving_time () const |
Check if *this time point is in daylight saving time. | |
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 | ( | ) |
Default constructor, uses default calendar initialized date_time object to current time.
std::bad_cast | Global locale does not have calendar_facet facet installed |
boost::locale::date_time::date_time | ( | double | time | ) |
Create a date_time object using POSIX time time and default calendar
std::bad_cast | Global locale does not have calendar_facet facet installed |
boost::locale::date_time::date_time | ( | const date_time_period_set & | set | ) |
Create a date_time object using default calendar and define values given in set
std::bad_cast | Global locale does not have calendar_facet facet installed |
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
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.
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.