C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
utility::datetime Class Reference

Public Types

enum  date_format { RFC_1123, ISO_8601 }
 Defines the supported date and time string formats. More...
 
enum  : interval_type { utc_timestamp_invalid = static_cast<interval_type>(-1) }
 An invalid UTC timestamp value. More...
 
typedef uint64_t interval_type
 

Public Member Functions

_ASYNCRTIMP utility::string_t to_string (date_format format=RFC_1123) const
 Returns a string representation of the datetime. More...
 
interval_type to_interval () const
 Returns the integral time value. More...
 
datetime operator- (interval_type value) const
 
datetime operator+ (interval_type value) const
 
bool operator== (datetime dt) const
 
bool operator!= (const datetime &dt) const
 
bool is_initialized () const
 

Static Public Member Functions

static _ASYNCRTIMP datetime __cdecl utc_now ()
 Returns the current UTC time. More...
 
static interval_type utc_timestamp ()
 Returns seconds since Unix/POSIX time epoch at 01-01-1970 00:00:00. If time is before epoch, utc_timestamp_invalid is returned. More...
 
static _ASYNCRTIMP datetime __cdecl from_string (const utility::string_t &timestring, date_format format=RFC_1123)
 Creates datetime from a string representing time in UTC in RFC 1123 format. More...
 
static interval_type from_milliseconds (unsigned int milliseconds)
 
static interval_type from_seconds (unsigned int seconds)
 
static interval_type from_minutes (unsigned int minutes)
 
static interval_type from_hours (unsigned int hours)
 
static interval_type from_days (unsigned int days)
 

Friends

int operator- (datetime t1, datetime t2)
 

Member Enumeration Documentation

anonymous enum : interval_type

An invalid UTC timestamp value.

Defines the supported date and time string formats.

Member Function Documentation

static _ASYNCRTIMP datetime __cdecl utility::datetime::from_string ( const utility::string_t &  timestring,
date_format  format = RFC_1123 
)
static

Creates datetime from a string representing time in UTC in RFC 1123 format.

Returns
Returns a datetime of zero if not successful.
interval_type utility::datetime::to_interval ( ) const
inline

Returns the integral time value.

_ASYNCRTIMP utility::string_t utility::datetime::to_string ( date_format  format = RFC_1123) const

Returns a string representation of the datetime.

static _ASYNCRTIMP datetime __cdecl utility::datetime::utc_now ( )
static

Returns the current UTC time.

static interval_type utility::datetime::utc_timestamp ( )
inlinestatic

Returns seconds since Unix/POSIX time epoch at 01-01-1970 00:00:00. If time is before epoch, utc_timestamp_invalid is returned.


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