date¶
A date is a year, month, and day, with an optional timezone offset.
Strings have the form YYYY-MM-DD with an optional timezone suffix, at least 4 year digits (negative or positive), and exactly 2 digits for both month and day. For example, “2001-02-03” or “2001-02-03-06:00”.
Canonical form has no leading zeros for the year.
-
EXESS_MAX_DATE_LENGTH¶
18U
The maximum length of a
datestring fromexess_write_date()
-
struct ExessDate¶
Date.
-
int16_t year¶
Year.
-
uint8_t month¶
Month: [1, 12].
-
uint8_t day¶
Day: [1, 31].
-
ExessTimezone zone¶
Timezone offset in quarter hours.
-
int16_t year¶
-
ExessOrder exess_compare_date(ExessDate lhs, ExessDate rhs)¶
Compare two dates.
Note that local and zoned dates may not be comparable. See
exess_compare_date_time()for details.- Returns:
Less than, equal to, or greater than zero if
lhsis less than, equal to, or greater thanrhs, respectively. Comparable and incomparable cases may also be distinguished, seeExessOrderfor details.
-
ExessResult exess_read_date(const char *str, ExessDate *out)¶
Read a
datestring after any leading whitespace.- Parameters:
str – String to read.
out – Parsed value, or zero on error.
- Returns:
The
countof characters read, and astatus.
-
ExessResult exess_write_date(ExessDate value, size_t buf_size, char *buf)¶
Write a canonical
datestring.The output is always in canonical form, like
2001-04-12or-2001-10-26+02:00.- Parameters:
value – Value to write.
buf_size – Size of
bufin bytes.buf – Output buffer, or null to only measure.
- Returns:
ExessStatus.EXESS_SUCCESSon success,ExessStatus.EXESS_NO_SPACEif the buffer is too small, orExessStatus.EXESS_BAD_VALUEif the value is invalid.