C++ Utilities 5.27.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
The DateTimeExpression struct holds information about a time expression (e.g. More...
#include <datetime.h>
Public Member Functions | |
constexpr DateTime | gmt () const |
Returns the value in UTC time. | |
constexpr bool | operator== (const DateTimeExpression &other) const |
Returns whether the expressions are equivalent. | |
std::string | toIsoString (char dateDelimiter='-', char timeDelimiter=':', char timeZoneDelimiter=':') const |
Returns the string representation of the current instance in the ISO format. | |
Static Public Member Functions | |
static DateTimeExpression | fromIsoString (const char *str) |
Parses the specified ISO date time denotation provided as C-style string. | |
static DateTimeExpression | fromString (const char *str) |
Parses the given C-style string. | |
Public Attributes | |
DateTime | value |
TimeSpan | delta |
DateTimeParts | parts = DateTimeParts::None |
The DateTimeExpression struct holds information about a time expression (e.g.
an ISO-8601 timestamp).
This struct holds the date and time specification (DateTimeExpression::value), the time-zone delta (DateTimeExpression::delta) and what parts are actually specified (DateTimeExpression::parts).
The idea is to be able to preserve a time-zone delta and present parts when deserializing and then serializing again. Note that it still does not allow to preserve the format of the original timestamp exactly.
Definition at line 163 of file datetime.h.
|
static |
Parses the specified ISO date time denotation provided as C-style string.
Throws | a ConversionException if the specified str does not match the expected time format. |
Definition at line 388 of file datetime.cpp.
|
static |
Parses the given C-style string.
Throws | a ConversionException if the specified str does not match the expected time format. |
The expected format is something like "2012-02-29 15:34:20.033" or "2012/02/29 15:34:20.033". The delimiters '-', ':' and '/' are exchangeable.
Definition at line 488 of file datetime.cpp.
|
constexpr |
Returns the value in UTC time.
Definition at line 178 of file datetime.h.
|
constexpr |
Returns whether the expressions are equivalent.
Definition at line 186 of file datetime.h.
std::string CppUtilities::DateTimeExpression::toIsoString | ( | char | dateDelimiter = '-', |
char | timeDelimiter = ':', | ||
char | timeZoneDelimiter = ':' ) const |
Returns the string representation of the current instance in the ISO format.
Definition at line 533 of file datetime.cpp.
TimeSpan CppUtilities::DateTimeExpression::delta |
The delta of value from UTC as TimeSpan object.
Definition at line 165 of file datetime.h.
DateTimeParts CppUtilities::DateTimeExpression::parts = DateTimeParts::None |
The parts present in the expression as flag enum.
Definition at line 166 of file datetime.h.
DateTime CppUtilities::DateTimeExpression::value |
The value of the time expression as DateTime object.
Definition at line 164 of file datetime.h.