8 #ifndef META_OCEAN_BASE_DATE_TIME_H
9 #define META_OCEAN_BASE_DATE_TIME_H
42 static std::string
string(
const bool addMilliseconds =
false);
50 static std::string
string(
const double timestamp,
const bool addMilliseconds =
false);
57 static std::string
stringDate(
const char delimiter =
'.');
65 static std::string
stringDate(
const double timestamp,
const bool nameMonths =
false);
74 static std::string
stringTime(
const bool addMilliseconds =
false,
const char delimiter =
'-');
84 static std::string
stringTime(
const double timestamp,
const bool addMilliseconds =
false,
const char delimiter =
'-');
122 static double date2timestamp(
const unsigned int year,
const unsigned int month,
const unsigned int day,
const unsigned int hour,
const unsigned int minute,
const unsigned int second,
const unsigned int millisecond = 0u);
135 static void timestamp2date(
const double timestamp,
unsigned int& year,
unsigned int& month,
unsigned int& day,
unsigned int& hour,
unsigned int& minute,
unsigned int& second,
unsigned int* millisecond =
nullptr);
145 static std::string
seconds2string(
const double totalSeconds,
const bool addDescription,
const bool addMilliseconds =
false);
154 static std::string
localStringTime(
const bool addMilliseconds =
false,
const char delimiter =
':');
160 static inline unsigned int isLeapYear(
const unsigned int year);
169 static bool isDateValid(
const unsigned int year,
const unsigned int month,
const unsigned int day);
174 return (year % 4u) == 0u && ((year % 100u != 0u) || (year % 400u == 0u));
This class provides basic functionalities for date and time handling.
Definition: DateTime.h:22
static std::string stringDate(const char delimiter='.')
Returns the string of the UTC date.
static bool isDateValid(const unsigned int year, const unsigned int month, const unsigned int day)
Returns whether a given date is a valid date (e.g., in no leap years the 29th February is an invalid ...
static long long microseconds()
Returns the microseconds since 1970.01.01 00::00::00 to current UTC time.
static std::string string(const bool addMilliseconds=false)
Returns the string of the UTC date and time.
static double timestamp()
Returns the seconds since 1970.01.01 00::00::00 to current UTC time.
static std::string stringTime(const bool addMilliseconds=false, const char delimiter='-')
Returns the string of the UTC time.
static std::string string(const double timestamp, const bool addMilliseconds=false)
Returns the string of a given unix timestamp.
static std::string localStringTime(const bool addMilliseconds=false, const char delimiter=':')
Returns the string of the local time.
static void timestamp2date(const double timestamp, unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second, unsigned int *millisecond=nullptr)
Converts a unix timestamp (the seconds since 1970.01.01 00:00:00) to a date.
static std::string stringDate(const double timestamp, const bool nameMonths=false)
Returns the string of a given unix timestamp.
static unsigned int isLeapYear(const unsigned int year)
Returns whether a given year is a leap year.
Definition: DateTime.h:172
static long long localMicroseconds()
Returns the microseconds since 1970.01.01 00::00::00 to current local time.
static std::string localString()
Returns the string of the local date and time.
static double localTimestamp()
Returns the seconds since 1970.01.01 00::00::00 to current local time.
static std::string stringTime(const double timestamp, const bool addMilliseconds=false, const char delimiter='-')
Returns the string of a given unix timestamp.
static std::string seconds2string(const double totalSeconds, const bool addDescription, const bool addMilliseconds=false)
Converts value of seconds to a time string showing the hours, minutes and seconds.
static std::string localStringDate(const char delimiter='.')
Returns the string of the local date.
static double date2timestamp(const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int minute, const unsigned int second, const unsigned int millisecond=0u)
Converts a date to the seconds since 1970.01.01 00:00:00.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15