userver: utils::datetime::Date Class Reference
Loading...
Searching...
No Matches
utils::datetime::Date Class Referencefinal

#include <userver/utils/datetime/date.hpp>

Detailed Description

Date in format YYYY-MM-DD, std::chrono::year_month_day like type.

Convertible to std::sys_days and could be constructed from year, month and day integers.

Definition at line 28 of file date.hpp.

Public Types

using Days = std::chrono::duration<long long, std::ratio<86400>>
 
using SysDays = std::chrono::time_point<std::chrono::system_clock, Days>
 

Public Member Functions

 Date (const Date &) noexcept=default
 
Dateoperator= (const Date &) noexcept=default
 
 Date (int year, int month, int day)
 Constructs Date without validation of input arguments.
 
constexpr Date (SysDays tp) noexcept
 constructor from system clock time point in days.
 
constexpr SysDays GetSysDays () const
 Returns a time point corresponding to the date.
 
constexpr operator SysDays () const
 Returns a time point corresponding to the date.
 
constexpr bool operator== (Date other) const
 
constexpr bool operator!= (Date other) const
 

Member Typedef Documentation

◆ Days

using utils::datetime::Date::Days = std::chrono::duration<long long, std::ratio<86400>>

Definition at line 30 of file date.hpp.

◆ SysDays

using utils::datetime::Date::SysDays = std::chrono::time_point<std::chrono::system_clock, Days>

Definition at line 31 of file date.hpp.

Constructor & Destructor Documentation

◆ Date()

constexpr utils::datetime::Date::Date ( SysDays tp)
inlineconstexprnoexcept

constructor from system clock time point in days.

Definition at line 41 of file date.hpp.

Member Function Documentation

◆ GetSysDays()

constexpr SysDays utils::datetime::Date::GetSysDays ( ) const
inlineconstexpr

Returns a time point corresponding to the date.

This function may return the same time point, that was passed to constructor.

Definition at line 47 of file date.hpp.

◆ operator SysDays()

constexpr utils::datetime::Date::operator SysDays ( ) const
inlineexplicitconstexpr

Returns a time point corresponding to the date.

This function may return the same time point, that was passed to constructor.

Definition at line 50 of file date.hpp.

◆ operator!=()

constexpr bool utils::datetime::Date::operator!= ( Date other) const
inlineconstexpr

Definition at line 55 of file date.hpp.

◆ operator==()

constexpr bool utils::datetime::Date::operator== ( Date other) const
inlineconstexpr

Definition at line 52 of file date.hpp.


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