Boost.Locale
Date, Time, Timezone and Calendar manipulations

Namespaces

namespace  boost::locale::period
 Namespace that contains various types for manipulation with dates.
 
namespace  boost::locale::time_zone
 namespace that holds functions for operating with global time zone
 

Classes

class  boost::locale::date_time_error
 This error is thrown in case of invalid state that occurred. More...
 
struct  boost::locale::date_time_period
 This class represents a pair of period_type and the integer values that describes its amount. For example 3 days or 4 years. More...
 
class  boost::locale::date_time_period_set
 This class represents a set of periods. More...
 
class  boost::locale::calendar
 this class provides an access to general calendar information. More...
 
class  boost::locale::date_time
 this class represents a date time and allows to perform various operation according to the locale settings. More...
 
class  boost::locale::date_time_duration
 This class represents a period: a pair of two date_time objects. More...
 

Functions

date_time_period_set boost::locale::operator+ (const date_time_period_set &a, const date_time_period_set &b)
 Append two periods sets. Note this operator is not commutative.
 
date_time_period_set boost::locale::operator- (const date_time_period_set &a, const date_time_period_set &b)
 Append two period sets when all periods of set change their sign.
 
void boost::locale::swap (date_time &left, date_time &right) noexcept
 
template<typename CharType >
std::basic_ostream< CharType > & boost::locale::operator<< (std::basic_ostream< CharType > &out, const date_time &t)
 
template<typename CharType >
std::basic_istream< CharType > & boost::locale::operator>> (std::basic_istream< CharType > &in, date_time &t)
 
date_time_duration boost::locale::operator- (const date_time &later, const date_time &earlier)
 

Detailed Description

This module provides various calendar, timezone and date time services

Function Documentation

◆ operator-()

date_time_duration boost::locale::operator- ( const date_time later,
const date_time earlier 
)
inline

Calculates the difference between two dates, the left operand is a later point on time line. Returns date_time_duration object.

◆ operator<<()

template<typename CharType >
std::basic_ostream< CharType > & boost::locale::operator<< ( std::basic_ostream< CharType > &  out,
const date_time t 
)

Writes date_time t to output stream out.

This function uses locale, calendar and time zone of the target stream in.

For example:

date_time now(time(nullptr),hebrew_calendar)
std::cout << "Year: " << period::year(now) << " Full Date:" << now;
this class represents a date time and allows to perform various operation according to the locale set...
Definition: date_time.hpp:558
period_type year()
Get period_type for: Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time.hpp:67

The output may be Year:5770 Full Date:Jan 1, 2010

◆ operator>>()

template<typename CharType >
std::basic_istream< CharType > & boost::locale::operator>> ( std::basic_istream< CharType > &  in,
date_time t 
)

Reads date_time t from output stream in

This function uses locale, calendar and time zone of the source stream in.