ItemValue
NameGREGORIAN-DATE (spec document BIND GREGORIAN-DATE)
TAG ID0x06AL
Codec ID0x000006A0
Spec document0x00000000/codecs/0x000006A0/ (DECLARE target 06A0)
Section3 0011 (Value), offset C within the section = 10
KindValue · family: TIME
TAG WORD0000 0110 1010 LLLL (000K KKKC CCCC LLLL)
Index descriptionSigned day count relative to proleptic Gregorian 1970-01-01
Hugo sidevalue/time/gregorian-date.md

Fields (spec document)

The order of FIELDs in the document is the order of the Payload fields (Codec spec document).

OrderField (BIND)FIELDWidthReceiving format (CODEC)ENUM
1days#2raw value, 2 WORD

GREGORIAN-DATE is a signed day count with proleptic Gregorian 1970-01-01 as day 0. It does not hold a time zone or a time of day.

Layout

  • Code: direct Value code 0x06AL. Family TIME.
  • It uses a fixed-width signed int32 physical type, the same as Arrow Date32 and Parquet DATE.
TAG WORD          0x06A2 (0000 0110 1010 0010)  total 3 WORD
Payload WORD 1st (bits 31..16)     Signed Day Count high 16bit
Payload WORD 2nd (bits 15..0)      Signed Day Count low 16bit

Interpretation and validity

  • The whole 2 WORD Payload is read as a 32-bit two’s complement signed day count in big-endian WORD order.
  • The valid range is -2^31 to 2^31-1 days. A negative value is a date before the epoch.
  • When converting a day count back to year, month, and day, the proleptic Gregorian calendar is used, with no historical calendar transition.
  • Even a small value always uses 2 WORD.

Length

  • The total is exactly 3 WORD, the TAG 1 WORD plus the Payload 2 WORD, and uses the direct length LLLL=0010. There is no Length extension TAG, descriptor, or padding.
  • If the Payload is not exactly 2 WORD, it is rejected.

Examples

DatePayloadTotal Length
1970-01-010000 00003 WORD (LLLL=0010)
1970-01-020000 00013 WORD (LLLL=0010)
1969-12-31FFFF FFFF3 WORD (LLLL=0010)

Relation to EDTF

  • Precision coarser than a day, uncertain or approximate dates, and intervals are written with EDTF. A date that can be written exactly with GREGORIAN-DATE is not written with EDTF (EDTF canonical form).

Standards basis

  • DATE of Apache Parquet Logical Types is an int32 that stores the number of days since the Unix epoch, 1970-01-01, and uses signed ordering.
  • Date32 of Apache Arrow Columnar Format and the authoritative Schema.fbs stores the number of days since the Unix epoch as a 32-bit signed integer.
  • The proleptic Gregorian conversion is the GEUL calendar profile adopted by this format. It keeps the int32 day-count meaning of Arrow/Parquet as is and adds only the TAG and big-endian 16-bit WORD framing.

Spec document source

This is the spec document 0x00000000/codecs/0x000006A0/latest.geul as read with geul show (hexadecimal in uppercase).

SPEC-VERSION 0x0001
DOC-ID 0x042600000000000006A000000000
BODY
#1 DECLARE 0x06A0
#2 FIELD #1 0x0002
#3 BIND #1 "GREGORIAN-DATE"
#4 BIND #2 "days"