ews-cpp
0.9
|
A thin wrapper around xs:dateTime formatted strings. More...
#include <ews.hpp>
Public Member Functions | |
date_time (std::string str) | |
bool | is_set () const EWS_NOEXCEPT |
time_t | to_epoch () const |
const std::string & | to_string () const EWS_NOEXCEPT |
Static Public Member Functions | |
static date_time | from_epoch (time_t epoch) |
Friends | |
bool | operator== (const date_time &, const date_time &) |
A thin wrapper around xs:dateTime formatted strings.
Microsoft EWS uses date and date/time string representations as described in https://www.w3.org/TR/xmlschema-2/, notably xs:dateTime and xs:date. Both seem to be a subset of ISO 8601.
For example, the lexical representation of xs:dateTime is
[-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]
whereas the last part represents the time zone (as offset to UTC). The Z means Zulu time which is a fancy way of meaning UTC. Two examples of date strings are:
2000-01-16Z and 1981-07-02.
xs:dateTime is formatted accordingly, just with a time component:
2001-10-26T21:32:52+02:00 and 2001-10-26T19:32:52Z.
You get the idea.
This library does not interpret, parse, or in any way touch date nor date/time strings in any circumstance. The date_time class acts solely as a thin wrapper to make the signatures of public API functions more type-rich and easier to understand. date_time is implicitly convertible from std::string.
If your date or date/time strings are not formatted properly, the Exchange Server will likely give you a SOAP fault which this library transports to you as an exception of type ews::soap_fault.
|
inlinestatic |
Constructs a xs:dateTime formatted string from given time value.
The resulting string is always formatted as:
yyyy-MM-ddThh:mm:ssZ
epoch | Seconds since the Epoch (this value is always in UTC) |
This function throws an exception of type ews::exception if converting to a string fails.
|
inline |
Converts this xs:dateTime to Seconds since the Epoch.
Returns this date-time string's corresponding seconds since the Epoch (this value is always in UTC) expressed as a value of type time_t or throws an exception of type ews::exception if this fails for some reason.