Calendar date and time.
More...
#include <cc/Date>
|
| | Date () |
| | Create an invalid date.
|
| |
| | Date (double time, int offset=0) |
| | Create a calendar date by breaking down a timestamp.
|
| |
| | Date (int year, int month, int day, int hour=0, int minutes=0, int seconds=0, int offset=0) |
| | Compose a calendar date from calendar components.
|
| |
| bool | isValid () const |
| | Tell if this is a date is valid.
|
| |
| double | time () const |
| | Seconds since the begin of Epoch (1st Jan 1970 00:00:00)
|
| |
| | operator bool () const |
| | Tell if this is a date is valid.
|
| |
| | operator double () const |
| | Seconds since the begin of Epoch (1st Jan 1970 00:00:00)
|
| |
| | operator String () const |
| | Return textual representation of this date
|
| |
| int | offset () const |
| | Time zone offset in seconds.
|
| |
| int | year () const |
| | Year number (1, 2,..., 2020, etc.)
|
| |
| int | month () const |
| | Month number (1..12)
|
| |
| int | day () const |
| | Day of month (1..31)
|
| |
| int | weekDay () const |
| | Day of the week (0..6)
|
| |
| int | yearDay () const |
| | Day of the year (1..365)
|
| |
| int | hour () const |
| | Hour of the day (0..23)
|
| |
| int | minutes () const |
| | Minutes (0..60)
|
| |
| int | seconds () const |
| | Seconds (0..60)
|
| |
| String | monthName () const |
| | Name of the month ("Jan", "Feb", ..., "Dec")
|
| |
| String | dayName () const |
| | Name of the weekday ("Sun", "Mon", ..., "Sat")
|
| |
| String | toString () const |
| | Return textual representation of this date
|
| |
| double | operator- (const Date &other) const |
| | Time difference in number of seconds.
|
| |
| bool | operator== (const Date &other) const |
| | Equal to operator.
|
| |
| std::strong_ordering | operator<=> (const Date &other) const |
| | Ordering operator.
|
| |
|
| static Date | now () |
| | Get the current UTC date and time.
|
| |
Calendar date and time.
- Todo
- toString(): fully enable ms resolution (ss.fraction in String output)
- See also
- Timezone
◆ Date() [1/3]
◆ Date() [2/3]
| Date |
( |
double | time, |
|
|
int | offset = 0 ) |
|
explicit |
Create a calendar date by breaking down a timestamp.
- Parameters
-
| time | Seconds since the begin of Epoch (1st Jan 1970 00:00:00) |
| offset | Time zone offset in seconds. |
- See also
- Timezone::offset()
◆ Date() [3/3]
| Date |
( |
int | year, |
|
|
int | month, |
|
|
int | day, |
|
|
int | hour = 0, |
|
|
int | minutes = 0, |
|
|
int | seconds = 0, |
|
|
int | offset = 0 ) |
Compose a calendar date from calendar components.
- Parameters
-
| year | Year number (1, 2,..., 2020, etc.) |
| month | Month number (1..12) |
| day | Day of month (1..31) |
| hour | Hour of the day (0..23) |
| minutes | Minutes (0..60) |
| seconds | Seconds (0..60) |
| offset | Time zone offset in seconds. |
- See also
- Timezone::offset()
◆ now()
Get the current UTC date and time.
◆ isValid()
Tell if this is a date is valid.
◆ time()
Seconds since the begin of Epoch (1st Jan 1970 00:00:00)
◆ operator bool()
Tell if this is a date is valid.
◆ operator double()
| operator double |
( |
| ) |
const |
Seconds since the begin of Epoch (1st Jan 1970 00:00:00)
◆ operator String()
Return textual representation of this date
◆ offset()
◆ year()
Year number (1, 2,..., 2020, etc.)
◆ month()
◆ day()
◆ weekDay()
◆ yearDay()
◆ hour()
◆ minutes()
◆ seconds()
◆ monthName()
Name of the month ("Jan", "Feb", ..., "Dec")
◆ dayName()
Name of the weekday ("Sun", "Mon", ..., "Sat")
◆ toString()
Return textual representation of this date
◆ operator-()
| double operator- |
( |
const Date & | other | ) |
const |
Time difference in number of seconds.
◆ operator==()
| bool operator== |
( |
const Date & | other | ) |
const |
◆ operator<=>()
| std::strong_ordering operator<=> |
( |
const Date & | other | ) |
const |