Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Static Public Member Functions | List of all members
hdi::core::DateTime Class Reference

Allows for acquisition and manipulation of a date (day of year) and time (of day) More...

#include <hdicoreDateTime.h>

Public Member Functions

 DateTime ()
 Constructs a DateTime object with a default value (1970-01-01 00:00:00) More...
 
 DateTime (const DateTime &dt_)
 Constructs a DateTime object from another existing DateTime object. More...
 
 DateTime (const Date &d_, const Time &t_)
 Constructs a DateTime object from existing Date and Time objects. More...
 
 DateTime (const int32_t ts_)
 Constructs a DateTime object from a POSIX timestamp. More...
 
 DateTime (const int64_t ts_)
 Constructs a DateTime object from a POSIX timestamp. More...
 
 DateTime (const double ts_)
 Constructs a DateTime object from a POSIX timestamp. More...
 
 DateTime (const std::string &dt_)
 Constructs a DateTime object from a string representation of a datetime. More...
 
 DateTime (const int16_t year_, const int16_t month_, const int16_t day_, const int16_t hour_, const int16_t min_, const int16_t sec_=0, const int32_t us_=0)
 Constructs a DateTime object from a given year, month, day, hour, minute, second, and microsecond. More...
 
virtual ~DateTime ()
 Destructs a DateTime object. More...
 
virtual DateTimeoperator= (const DateTime &rhs_)
 Overloaded assignment operator to copy values from one DateTime object to another. More...
 
virtual bool operator== (const DateTime &rhs_) const
 Overloaded equality operator to determine if two DateTime objects are equal. More...
 
virtual bool operator!= (const DateTime &rhs_) const
 Overloaded inequality operator to determine if two DateTime objects differ. More...
 
virtual bool operator< (const DateTime &rhs_) const
 Overloaded less-than operator to determine if one DateTime object is earlier in time than the other. More...
 
virtual bool operator<= (const DateTime &rhs_) const
 Overloaded less-than-or-equal operator to determine if one DateTime object is earlier in time than, or equal to, the other. More...
 
virtual bool operator> (const DateTime &rhs_) const
 Overloaded greater-than operator to determine if one DateTime object is later in time than the other. More...
 
virtual bool operator>= (const DateTime &rhs_) const
 Overloaded greater-than-or-equal operator to determine if one DateTime object is later in time than, or equal to, the other. More...
 
virtual Duration operator- (const DateTime &rhs_) const
 Overloaded subtraction operator to determine the duration between two DateTime objects. More...
 
virtual DateTime operator- (const Duration &rhs_) const
 Overloaded substraction operator to determine the resultant date and time before the target. More...
 
virtual DateTimeoperator-= (const Duration &rhs_)
 Overloaded subtraction-assignment operator to determine and assign the resultant date and time before the initial target. More...
 
virtual DateTime operator+ (const Duration &rhs_) const
 Overloaded addition operator to determine the resultant date and time after the target. More...
 
virtual DateTimeoperator+= (const Duration &rhs_)
 Overloaded addition-assignment operator to determine and assign the resultant date and time after the initial target. More...
 
Date date () const
 Gets the date for the DateTime object. More...
 
void setDate (const Date &d_)
 Sets the date for the DateTime object. More...
 
Time time () const
 Gets the time for the DateTime object. More...
 
void setTime (const Time &t_)
 Sets the time for the DateTime object. More...
 
virtual std::string format (const std::string &format_="Y-m-d H:i:s") const
 Formats the target DateTime object into a string representation. More...
 

Static Public Member Functions

static DateTime Current (const bool us_=false)
 Constructs a DateTime object from the current system time. More...
 

Detailed Description

Allows for acquisition and manipulation of a date (day of year) and time (of day)

Constructor & Destructor Documentation

hdi::core::DateTime::DateTime ( )

Constructs a DateTime object with a default value (1970-01-01 00:00:00)

Author
GW
Date
11/2014
hdi::core::DateTime::DateTime ( const DateTime dt_)

Constructs a DateTime object from another existing DateTime object.

Author
GW
Date
11/2014
Parameters
dt_Existing object to copy values from
hdi::core::DateTime::DateTime ( const Date d_,
const Time t_ 
)

Constructs a DateTime object from existing Date and Time objects.

Author
GW
Date
11/2014
Parameters
d_Existing Date object
t_Existing Time object
hdi::core::DateTime::DateTime ( const int32_t  ts_)
explicit

Constructs a DateTime object from a POSIX timestamp.

Author
GW
Date
11/2014
Parameters
ts_Timestamp to use
hdi::core::DateTime::DateTime ( const int64_t  ts_)
explicit

Constructs a DateTime object from a POSIX timestamp.

Author
GW
Date
11/2014
Parameters
ts_Timestamp to use
hdi::core::DateTime::DateTime ( const double  ts_)
explicit

Constructs a DateTime object from a POSIX timestamp.

Author
GW
Date
11/2014
Parameters
ts_Timestamp to use
hdi::core::DateTime::DateTime ( const std::string &  dt_)

Constructs a DateTime object from a string representation of a datetime.

Author
GW
Date
11/2014
Parameters
dt_String representation of a datetime
Note
The expected format is e.g. "2014-11-25 14:34:56.789". A variety of delimiters can be used for the date (i.e. '-', '.', '/', and ',') and time (i.e. ':', '-', '.', and ','). Strings that do not follow this format have the same result as using the DateTime() ctor.
hdi::core::DateTime::DateTime ( const int16_t  year_,
const int16_t  month_,
const int16_t  day_,
const int16_t  hour_,
const int16_t  min_,
const int16_t  sec_ = 0,
const int32_t  us_ = 0 
)

Constructs a DateTime object from a given year, month, day, hour, minute, second, and microsecond.

Author
GW
Date
11/2014
Parameters
year_Year, in the range [1970,9999]
month_Month of the given year, in the range [1,12]
day_Day of the month, in the range [1,31]
hour_Hour of the day, in the range [0,23]
min_Minute of the given hour, in the range [0,59]
sec_Second of the given minute, in the range [0,59]
us_Microsecond of the given second, in the range [0,999999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual hdi::core::DateTime::~DateTime ( )
virtual

Destructs a DateTime object.

Author
GW
Date
11/2014

Member Function Documentation

static DateTime hdi::core::DateTime::Current ( const bool  us_ = false)
static

Constructs a DateTime object from the current system time.

Author
GW
Date
11/2014
Parameters
us_Whether to use microsecond resolution
Returns
A DateTime object for the current UTC time
Date hdi::core::DateTime::date ( ) const

Gets the date for the DateTime object.

Author
GW
Date
11/2014
Returns
The date of the target DateTime
Note
Modifying the returned Date object will not affect the target DateTime object. If you make changes to the Date object, the target DateTime object must be updated with the setDate() method.
virtual std::string hdi::core::DateTime::format ( const std::string &  format_ = "Y-m-d H:i:s") const
virtual

Formats the target DateTime object into a string representation.

Author
GW
Date
11/2014
Parameters
format_Input string representing the format for the output string
Returns
An output string for the target object's date and time, formatted as indicated
Note
For a description of the supported formatting characters, see the notes for the Date::format() and Time::format() methods.
virtual bool hdi::core::DateTime::operator!= ( const DateTime rhs_) const
virtual

Overloaded inequality operator to determine if two DateTime objects differ.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator,
Returns
true if the two objects represent different days or times
virtual DateTime hdi::core::DateTime::operator+ ( const Duration rhs_) const
virtual

Overloaded addition operator to determine the resultant date and time after the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The date and time that would result from adding the duration to the target
virtual DateTime& hdi::core::DateTime::operator+= ( const Duration rhs_)
virtual

Overloaded addition-assignment operator to determine and assign the resultant date and time after the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The target DateTime object, but with its values updated to reflect the addition of the given duration
virtual Duration hdi::core::DateTime::operator- ( const DateTime rhs_) const
virtual

Overloaded subtraction operator to determine the duration between two DateTime objects.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, DateTime object to "substract" from the lefthand side
Returns
The duration between the two days and times
virtual DateTime hdi::core::DateTime::operator- ( const Duration rhs_) const
virtual

Overloaded substraction operator to determine the resultant date and time before the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The date and time that would result from subtracting the duration from the target
virtual DateTime& hdi::core::DateTime::operator-= ( const Duration rhs_)
virtual

Overloaded subtraction-assignment operator to determine and assign the resultant date and time before the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The target DateTime object, but with its values updated to reflect the substraction of the given duration
virtual bool hdi::core::DateTime::operator< ( const DateTime rhs_) const
virtual

Overloaded less-than operator to determine if one DateTime object is earlier in time than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; DateTime object that might be later in time than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date earlier than rhs_
virtual bool hdi::core::DateTime::operator<= ( const DateTime rhs_) const
virtual

Overloaded less-than-or-equal operator to determine if one DateTime object is earlier in time than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; DateTime object that might be later in time than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date earlier than, or equal to, rhs_
virtual DateTime& hdi::core::DateTime::operator= ( const DateTime rhs_)
virtual

Overloaded assignment operator to copy values from one DateTime object to another.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, DateTime object to copy values from
Returns
The target DateTime object, but with values updated to match that of rhs_
virtual bool hdi::core::DateTime::operator== ( const DateTime rhs_) const
virtual

Overloaded equality operator to determine if two DateTime objects are equal.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, DateTime object to compare
Returns
true if the two objects represent the same date and time
virtual bool hdi::core::DateTime::operator> ( const DateTime rhs_) const
virtual

Overloaded greater-than operator to determine if one DateTime object is later in time than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; DateTime object that might be earlier in time than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date later than rhs_
virtual bool hdi::core::DateTime::operator>= ( const DateTime rhs_) const
virtual

Overloaded greater-than-or-equal operator to determine if one DateTime object is later in time than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; DateTime object that might be earlier in time than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date later than, or equal to, rhs_
void hdi::core::DateTime::setDate ( const Date d_)

Sets the date for the DateTime object.

Author
GW
Date
11/2014
Parameters
d_New date for the target DateTime
void hdi::core::DateTime::setTime ( const Time t_)

Sets the time for the DateTime object.

Author
GW
Date
11/2014
Parameters
t_New time for the target DateTime
Time hdi::core::DateTime::time ( ) const

Gets the time for the DateTime object.

Author
GW
Date
11/2014
Returns
The time of the target DateTime
Note
Modifying the returned Time object will not affect the target DateTime object. If you make changes to the Time object, the target DateTime object must be updated with the setTime() method.