|
static double | timestamp () |
| Returns the seconds since 1970.01.01 00::00::00 to current UTC time. More...
|
|
static long long | microseconds () |
| Returns the microseconds since 1970.01.01 00::00::00 to current UTC time. More...
|
|
static std::string | string (const bool addMilliseconds=false) |
| Returns the string of the UTC date and time. More...
|
|
static std::string | string (const double timestamp, const bool addMilliseconds=false) |
| Returns the string of a given unix timestamp. More...
|
|
static std::string | stringDate (const char delimiter='.') |
| Returns the string of the UTC date. More...
|
|
static std::string | stringDate (const double timestamp, const bool nameMonths=false) |
| Returns the string of a given unix timestamp. More...
|
|
static std::string | stringTime (const bool addMilliseconds=false, const char delimiter='-') |
| Returns the string of the UTC time. More...
|
|
static std::string | stringTime (const double timestamp, const bool addMilliseconds=false, const char delimiter='-') |
| Returns the string of a given unix timestamp. More...
|
|
static double | localTimestamp () |
| Returns the seconds since 1970.01.01 00::00::00 to current local time. More...
|
|
static long long | localMicroseconds () |
| Returns the microseconds since 1970.01.01 00::00::00 to current local time. More...
|
|
static std::string | localString () |
| Returns the string of the local date and time. More...
|
|
static std::string | localStringDate (const char delimiter='.') |
| Returns the string of the local date. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
static std::string | localStringTime (const bool addMilliseconds=false, const char delimiter=':') |
| Returns the string of the local time. More...
|
|
static unsigned int | isLeapYear (const unsigned int year) |
| Returns whether a given year is a leap year. More...
|
|
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 date) More...
|
|
This class provides basic functionalities for date and time handling.
All functions are available for UTC and local time.
static std::string Ocean::DateTime::seconds2string |
( |
const double |
totalSeconds, |
|
|
const bool |
addDescription, |
|
|
const bool |
addMilliseconds = false |
|
) |
| |
|
static |
Converts value of seconds to a time string showing the hours, minutes and seconds.
The resulting string has the following format: HH:MM:SS, or HH:MM:SS:mmmm if the milliseconds are added; or H hours, M minutes, S seconds or H hours, M minutes, S seconds, m milliseconds if the description is added.
- Parameters
-
totalSeconds | The number of seconds to convert, with range [0, infinity) |
addDescription | True, to add the description text to the string |
addMilliseconds | True, to add the milliseconds to the string |
- Returns
- Time string of local time