The Concise Binary Object Representation (CBOR) [
RFC 7049] provides for the interchange of structured data without a requirement for a pre-agreed schema.
RFC 7049 defines a basic set of data types, as well as a tagging mechanism that enables extending the set of data types supported via an IANA registry.
This specification defines a CBOR tag for a text string representing a date without a time. The tagged text string is represented as specified by the
RFC 3339 [
RFC 3339]
full-date production. Per
RFC 3339, this represents a date within the Gregorian calendar.
This specification also defines a CBOR tag for an integer representing a date without a time. The tagged integer is an unsigned or negative value indicating the number of days since the Gregorian calendar date 1970-01-01. As an implementation note, this value has a constant offset from the Modified Julian Date value (which is defined by the Smithsonian Astrophysical Observatory as the number of days since November 17, 1858); this value is the Modified Julian Date minus 40587.
Note that since both tags are for dates without times, times of day, time zones, and leap seconds are not applicable to these values. These tags are both for representations of Gregorian calendar dates.
Calendar dates are used for numerous human use cases, such as marking the dates of significant events. For instance, John Lennon was born on October 9, 1940 and died on December 8, 1980. One such use case is driver's licenses, which typically include a date of birth. The dates used in this specification use the Gregorian calendar, as do those in
RFC 3339 [
RFC 3339]. The time zones and actual times of these events are intentionally not represented in the calendar date.
The epoch chosen for the second tag, which represents days since the Gregorian calendar date 1970-01-01, is related to the IEEE Std 1003.1, 2013 Edition [
POSIX.1] time epoch 1970-01-01T00:00:00Z UTC only insofar as both contain the date 1970-01-01. This should not be construed as indicating that dates using this tag represent either a specific time of day and/or time zone.
The day of the week (Sunday, Monday, Tuesday, etc.) is not explicitly represented in either of these date formats. However, deterministic algorithms that are beyond the scope of this specification can be used to derive the day of the week in the Gregorian calendar from dates represented in both of these formats.
This table contains example representations for dates using both tags.
Date |
Tag 1004 |
Tag 100 |
October 9, 1940 |
"1940-10-09" |
-10676 |
December 8, 1980 |
"1980-12-08" |
3994 |
Table 1
Comparison of dates in
full-date format can be accomplished by normal string comparison, since, by design, the digits representing the date are in fixed format and ordered from most significant to least significant. Comparison of numeric dates representing days since 1970-01-01 can be performed by normal integer comparison. Comparison of dates in other formats or using other calendars require conversions that are beyond the scope of this specification.
Note that different dates may correspond to the same moment in time, depending upon the time zone in which the date was determined. For instance, at many times of the day, a conference call occurring on a particular date in Japan will simultaneously occur on the previous date in Hawaii; at many times of the day, Japan's Friday corresponds with Hawaii's Thursday.
Comparing dates with date/time values, which represent a particular moment in time, is beyond the scope of this specification. That said, if a date is augmented with a time zone and time of day, a specific date/time value can be determined, and comparing that date/time value to others becomes possible. For instance, if one were to augment John Lennon's birth date of October 9, 1940 with the time of day and time zone of his birth, then it would be possible to derive a date/time at which he was born that could be compared with other date/time values.