AWS SDK for C++  1.7.233
AWS SDK for C++
Public Member Functions | Static Public Member Functions | List of all members
Aws::Utils::DateTime Class Reference

#include <DateTime.h>

Public Member Functions

 DateTime ()
 
 DateTime (const std::chrono::system_clock::time_point &timepointToAssign)
 
 DateTime (int64_t millisSinceEpoch)
 
 DateTime (double epoch_millis)
 
 DateTime (const Aws::String &timestamp, DateFormat format)
 
 DateTime (const char *timestamp, DateFormat format)
 
bool operator== (const DateTime &other) const
 
bool operator< (const DateTime &other) const
 
bool operator> (const DateTime &other) const
 
bool operator!= (const DateTime &other) const
 
bool operator<= (const DateTime &other) const
 
bool operator>= (const DateTime &other) const
 
DateTime operator+ (const std::chrono::milliseconds &a) const
 
DateTime operator- (const std::chrono::milliseconds &a) const
 
DateTimeoperator= (double secondsSinceEpoch)
 
DateTimeoperator= (int64_t millisSinceEpoch)
 
DateTimeoperator= (const std::chrono::system_clock::time_point &timepointToAssign)
 
DateTimeoperator= (const Aws::String &timestamp)
 
bool WasParseSuccessful () const
 
Aws::String ToLocalTimeString (DateFormat format) const
 
Aws::String ToLocalTimeString (const char *formatStr) const
 
Aws::String ToGmtString (DateFormat format) const
 
Aws::String ToGmtString (const char *formatStr) const
 
double SecondsWithMSPrecision () const
 
int64_t Millis () const
 
std::chrono::system_clock::time_point UnderlyingTimestamp () const
 
int GetYear (bool localTime=false) const
 
Month GetMonth (bool localTime=false) const
 
int GetDay (bool localTime=false) const
 
DayOfWeek GetDayOfWeek (bool localTime=false) const
 
int GetHour (bool localTime=false) const
 
int GetMinute (bool localTime=false) const
 
int GetSecond (bool localTime=false) const
 
bool IsDST (bool localTime=false) const
 
std::chrono::milliseconds operator- (const DateTime &other) const
 

Static Public Member Functions

static DateTime Now ()
 
static int64_t CurrentTimeMillis ()
 
static Aws::String CalculateLocalTimestampAsString (const char *formatStr)
 
static Aws::String CalculateGmtTimestampAsString (const char *formatStr)
 
static int CalculateCurrentHour ()
 
static double ComputeCurrentTimestampInAmazonFormat ()
 
static Aws::String CalculateGmtTimeWithMsPrecision ()
 
static std::chrono::milliseconds Diff (const DateTime &a, const DateTime &b)
 

Detailed Description

Wrapper for all the weird crap we need to do with timestamps.

Definition at line 63 of file DateTime.h.

Constructor & Destructor Documentation

◆ DateTime() [1/6]

Aws::Utils::DateTime::DateTime ( )

Initializes time point to epoch

◆ DateTime() [2/6]

Aws::Utils::DateTime::DateTime ( const std::chrono::system_clock::time_point &  timepointToAssign)

Initializes time point to any other arbirtrary timepoint

◆ DateTime() [3/6]

Aws::Utils::DateTime::DateTime ( int64_t  millisSinceEpoch)

Initializes time point to millis Since epoch

◆ DateTime() [4/6]

Aws::Utils::DateTime::DateTime ( double  epoch_millis)

Initializes time point to epoch time in seconds.millis

◆ DateTime() [5/6]

Aws::Utils::DateTime::DateTime ( const Aws::String timestamp,
DateFormat  format 
)

Initializes time point to value represented by timestamp and format.

◆ DateTime() [6/6]

Aws::Utils::DateTime::DateTime ( const char *  timestamp,
DateFormat  format 
)

Initializes time point to value represented by timestamp and format.

Member Function Documentation

◆ CalculateCurrentHour()

static int Aws::Utils::DateTime::CalculateCurrentHour ( )
static

Calculates the current hour of the day in localtime.

◆ CalculateGmtTimestampAsString()

static Aws::String Aws::Utils::DateTime::CalculateGmtTimestampAsString ( const char *  formatStr)
static

Calculates the current gmt timestamp, formats it, and returns it as a string

◆ CalculateGmtTimeWithMsPrecision()

static Aws::String Aws::Utils::DateTime::CalculateGmtTimeWithMsPrecision ( )
static

Calculates the current time in GMT with millisecond precision using the format "Year-month-day hours:minutes:seconds.milliseconds"

◆ CalculateLocalTimestampAsString()

static Aws::String Aws::Utils::DateTime::CalculateLocalTimestampAsString ( const char *  formatStr)
static

Calculates the current local timestamp, formats it and returns it as a string

◆ ComputeCurrentTimestampInAmazonFormat()

static double Aws::Utils::DateTime::ComputeCurrentTimestampInAmazonFormat ( )
static

The amazon timestamp format is a double with seconds.milliseconds

◆ CurrentTimeMillis()

static int64_t Aws::Utils::DateTime::CurrentTimeMillis ( )
static

Get the millis since epoch representing this very instant.

◆ Diff()

static std::chrono::milliseconds Aws::Utils::DateTime::Diff ( const DateTime a,
const DateTime b 
)
static

Compute the difference between two timestamps.

◆ GetDay()

int Aws::Utils::DateTime::GetDay ( bool  localTime = false) const

Get the Day of the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetDayOfWeek()

DayOfWeek Aws::Utils::DateTime::GetDayOfWeek ( bool  localTime = false) const

Get the Day of the Week portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetHour()

int Aws::Utils::DateTime::GetHour ( bool  localTime = false) const

Get the Hour portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetMinute()

int Aws::Utils::DateTime::GetMinute ( bool  localTime = false) const

Get the Minute portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetMonth()

Month Aws::Utils::DateTime::GetMonth ( bool  localTime = false) const

Get the Month portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetSecond()

int Aws::Utils::DateTime::GetSecond ( bool  localTime = false) const

Get the Second portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ GetYear()

int Aws::Utils::DateTime::GetYear ( bool  localTime = false) const

Get the Year portion of this dateTime. localTime if true, return local time, otherwise return UTC

◆ IsDST()

bool Aws::Utils::DateTime::IsDST ( bool  localTime = false) const

Get whether or not this dateTime is in Daylight savings time. localTime if true, return local time, otherwise return UTC

◆ Millis()

int64_t Aws::Utils::DateTime::Millis ( ) const

Milliseconds since epoch of this datetime.

◆ Now()

static DateTime Aws::Utils::DateTime::Now ( )
static

Get an instance of DateTime representing this very instant.

◆ operator!=()

bool Aws::Utils::DateTime::operator!= ( const DateTime other) const

◆ operator+()

DateTime Aws::Utils::DateTime::operator+ ( const std::chrono::milliseconds &  a) const

◆ operator-() [1/2]

DateTime Aws::Utils::DateTime::operator- ( const std::chrono::milliseconds &  a) const

◆ operator-() [2/2]

std::chrono::milliseconds Aws::Utils::DateTime::operator- ( const DateTime other) const

◆ operator<()

bool Aws::Utils::DateTime::operator< ( const DateTime other) const

◆ operator<=()

bool Aws::Utils::DateTime::operator<= ( const DateTime other) const

◆ operator=() [1/4]

DateTime& Aws::Utils::DateTime::operator= ( double  secondsSinceEpoch)

Assign from seconds.millis since epoch.

◆ operator=() [2/4]

DateTime& Aws::Utils::DateTime::operator= ( int64_t  millisSinceEpoch)

Assign from millis since epoch.

◆ operator=() [3/4]

DateTime& Aws::Utils::DateTime::operator= ( const std::chrono::system_clock::time_point &  timepointToAssign)

Assign from another time_point

◆ operator=() [4/4]

DateTime& Aws::Utils::DateTime::operator= ( const Aws::String timestamp)

Assign from an ISO8601 or RFC822 formatted string

◆ operator==()

bool Aws::Utils::DateTime::operator== ( const DateTime other) const

◆ operator>()

bool Aws::Utils::DateTime::operator> ( const DateTime other) const

◆ operator>=()

bool Aws::Utils::DateTime::operator>= ( const DateTime other) const

◆ SecondsWithMSPrecision()

double Aws::Utils::DateTime::SecondsWithMSPrecision ( ) const

Get the representation of this datetime as seconds.milliseconds since epoch

◆ ToGmtString() [1/2]

Aws::String Aws::Utils::DateTime::ToGmtString ( DateFormat  format) const

Convert dateTime to GMT time string using predefined format.

◆ ToGmtString() [2/2]

Aws::String Aws::Utils::DateTime::ToGmtString ( const char *  formatStr) const

Convert dateTime to GMT time string using arbitrary format.

◆ ToLocalTimeString() [1/2]

Aws::String Aws::Utils::DateTime::ToLocalTimeString ( DateFormat  format) const

Convert dateTime to local time string using predefined format.

◆ ToLocalTimeString() [2/2]

Aws::String Aws::Utils::DateTime::ToLocalTimeString ( const char *  formatStr) const

Convert dateTime to local time string using arbitrary format.

◆ UnderlyingTimestamp()

std::chrono::system_clock::time_point Aws::Utils::DateTime::UnderlyingTimestamp ( ) const

In the likely case this class doesn't do everything you need to do, here's a copy of the time_point structure. Have fun.

◆ WasParseSuccessful()

bool Aws::Utils::DateTime::WasParseSuccessful ( ) const
inline

Whether or not parsing the timestamp from string was successful.

Definition at line 129 of file DateTime.h.


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