16 #ifndef _A_UTILS_UTIL_DATETIME_DATETIME_HEADER_INCLUDED_
17 #define _A_UTILS_UTIL_DATETIME_DATETIME_HEADER_INCLUDED_
40 Date(
int year,
int month,
int day);
48 void set(
int year,
int month,
int day);
62 bool set(
const std::string& date);
112 std::string
format(
const std::string& format_str)
const;
164 Time(
int hour,
int minute,
int second,
int microsecond = 0);
173 void set(
int hour,
int minute,
int second,
int microsecond = 0);
187 bool set(
const std::string& time);
244 std::string
format(
const std::string& format_str)
const;
321 DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int microsecond = 0);
333 void set(
int year,
int month,
int day,
int hour,
int minute,
int second,
int microsecond = 0);
452 std::string format(const std::string& format_str) const;
475 bool set(
const std::string& format_str,
const std::string& date_time);
Date implementation representing a date consisting of year, month and day.
void setMonth(int month)
Set the month.
int getMonth() const
Get the month.
void setYear(int year)
Set the year.
bool set(const std::string &date)
Sets the stored date given a date string.
std::string format(const std::string &format_str) const
Creates a string representation of the stored date.
Date(int year, int month, int day)
Constructor for presetting the stored date.
void set(int year, int month, int day)
Sets the stored date.
int getDay() const
Get the day of the month.
void setDay(int day)
Sets the day of the month.
int getYear() const
Get the year.
Date()
Default constructor - initializes the date to 00.00.0000.
DateTime class representing both Date and Time.
bool set(const std::string &format_str, const std::string &date_time)
Sets the date time given a string.
DateTime(int year, int month, int day, int hour, int minute, int second, int microsecond=0)
Constructor for presetting the stored date and time.
DateTime()
Default constructor - see Date and Time constructors.
void set(timestamp_t timestamp, TimestampReference timestampReference=TimestampReference::MicroSecondsSinceJulianDateOrigin)
Set stored data and time from a timestamp.
void set(int year, int month, int day, int hour, int minute, int second, int microsecond=0)
Set the stored date and time.
timestamp_t toTimestamp(TimestampReference timestampReference=TimestampReference::MicroSecondsSinceJulianDateOrigin) const
Convert stored date and time to a timestamp.
Time implementation representing a time of day (00:00:00,0 - 23:59:59,999999)
void setMinute(int minute)
Set the minute.
void setSecond(int second)
Set the second.
int getSecond() const
Get the second.
int getHour() const
Get the hour.
bool set(const std::string &time)
Sets the time a given time string.
Time()
Default constructor - initializes the time to 00:00:00,0.
int getMicrosecond() const
Get the microsecond.
std::string format(const std::string &format_str) const
Creates a string representation of the stored time.
int getMinute() const
Get the minute.
void setMicrosecond(int microsecond)
Set the microsecond.
void setHour(int hour)
Set the hour.
Time(int hour, int minute, int second, int microsecond=0)
Constructor for presetting the stored time.
void set(int hour, int minute, int second, int microsecond=0)
Sets the stored time.
std::int64_t timestamp_t
Type of a timestamp value. If not otherwise stated, always in microseconds.
DateTime getCurrentSystemDateTime()
Get the current date and time (in UTC format).
bool operator==(const Date &lhs, const Date &rhs)
Compare two dates for equality.
Time getCurrentSystemTime()
Get the current time (in UTC format).
Date getCurrentLocalDate()
Retrieves the current date (hardware clock with respect to timezone).
DateTime getCurrentLocalDateTime()
Get the current date and time (hardware clock with respect to timezone).
Time getCurrentLocalTime()
Get the current time (hardware clock with respect to timezone).
TimestampReference
The reference point in time.
@ MicroSecondsSinceJulianDateOrigin
Reference point in time is noon on Monday, January 1, 4713 BC (Julian day)
@ MicroSecondsSinceUnixTimeOrigin
Reference point in time is midnight on Thursday, 1 January 1970 AC (Unix time)
Date getCurrentSystemDate()
Retrieves the current system date (in UTC format).
bool operator!=(const Date &lhs, const Date &rhs)
Compare two dates for inequality.
Serves as the root component, with common functionality documented in core functionality.
Public types and functions defining a_util core functionality.