Date

An xsd:date is a year, month, and day, with optional timezone.

struct ExessDate

Date (xsd:date)

int16_t year
uint8_t month
uint8_t day
ExessTimezone zone
int exess_date_compare(ExessDate lhs, ExessDate rhs)

Compare two dates.

Note that comparison of dates is not always determinate. The comparison of two dates works the same way as the comparison of two datetimes with equivalent times, except adjusted according to the timezone if necessary. See exess_datetime_compare() for details.

Returns

-1, 0, or 1 if lhs is less than, equal to, or greater than rhs, respectively.

ExessResult exess_read_date(ExessDate *out, const char *str)

Read an xsd:date string after any leading whitespace.

Parameters
  • out – Set to the parsed value, or zero on error.

  • str – String input.

Returns

The count of characters read, and a status code.

ExessResult exess_write_date(ExessDate value, size_t buf_size, char *buf)

Write a canonical xsd:date string.

The output is always in canonical form, like 2001-04-12 or -2001-10-26+02:00.

Parameters
  • value – Value to write.

  • buf_size – The size of buf in bytes.

  • buf – Output buffer, or null to only measure.

Returns

ExessStatus.EXESS_SUCCESS on success, ExessStatus.EXESS_NO_SPACE if the buffer is too small, or ExessStatus.EXESS_BAD_VALUE if the value is invalid.

EXESS_MAX_DATE_LENGTH

The maximum length of an xsd:date string from exess_write_date(), 18.