A calendar date (proleptic Gregorian), stored as days since 1970-01-01 -- identical to the physical value of a Parquet DATE / Arrow date32 column. A default-initialized element is null. Range: about +-5.8 million years.
Constructs a valid parquet_date from (year, month, day); aborts on an invalid civil date (the structure constructor itself is unavailable outside this module -- components are private -- so this generic takes its place).
Constructor specific for the parquet_date generic: builds a valid date element from (year, month, day); aborts on an invalid civil date.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(in) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(in) | :: | day |
day of month. |
the constructed element (valid).
Sets from a validated (year, month, day).
Sets the element from civil fields (proleptic Gregorian), validating month, day, and the representable range; marks it valid.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(inout) | :: | self |
receives the date (marked valid). |
||
| integer(kind=int32), | intent(in) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(in) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(in) | :: | day |
day of month, 1..days_in_month. |
Returns year, month, day (aborts on null).
Returns the civil fields of the element; aborts on a null element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
||
| integer(kind=int32), | intent(out) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(out) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(out) | :: | day |
day of month. |
Calendar year (aborts on null).
Returns the calendar year; aborts on a null element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
Calendar month 1..12 (aborts on null).
Returns the calendar month (1..12); aborts on a null element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
Day of month 1..31 (aborts on null).
Returns the day of month (1..31); aborts on a null element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
Whether the element is null (never aborts).
Returns whether the element is null (the primary null guard; never aborts).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
Marks the element null.
Marks the element null.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(inout) | :: | self |
the element (reset to the null state). |
Sets the raw day count (interop; marks valid).
Sets the raw day count directly (interop/advanced accessor; marks the element valid).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(inout) | :: | self |
receives the value (marked valid). |
||
| integer(kind=int32), | intent(in) | :: | days |
days since 1970-01-01 (the Parquet DATE value). |
Raw day count; 0 for a null element (interop).
Returns the raw day count, or 0 for a null element (interop/advanced accessor; never aborts -- validity travels separately via is_null).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
Sets from an integer Modified Julian Date.
int32 specific of set_mjd; see the set_mjd generic.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(inout) | :: | self |
receives the date (marked valid). |
||
| integer(kind=int32), | intent(in) | :: | mjd |
integer Modified Julian Date. |
int64 specific of set_mjd: sets the element from an integer Modified Julian Date (MJD 0 = 1858-11-17); aborts if out of the representable range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(inout) | :: | self |
receives the date (marked valid). |
||
| integer(kind=int64), | intent(in) | :: | mjd |
integer Modified Julian Date. |
Integer Modified Julian Date (aborts on null).
Returns the integer Modified Julian Date (MJD 0 = 1858-11-17); aborts on a null element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
ISO-8601 "YYYY-MM-DD" (aborts on null).
Writes the element as ISO-8601 "YYYY-MM-DD" (years 0..9999 zero-padded to 4 digits;
a leading '-' and more digits otherwise); aborts on a null element. A subroutine (not a
function) so this never returns character(len=:), allocatable as a function result --
see "Build and compiler notes" in CLAUDE.md for why.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element. |
||
| character(len=:), | intent(out), | allocatable | :: | str |
receives the formatted date. |
Sets from an ISO-8601 date string.
Sets the element from an ISO-8601 date string "[-]YYYY-MM-DD". On failure (not parseable
as a valid civil date): error stop by default; if success is present, no abort happens
-- success is set .false. and the element is left null (a defined state) instead.
(This procedure's header line -- and five others in this file: date_new, time_parse,
time_new, ts_parse, ts_new_civil -- never register as "hit" in gcov, even though every
other line of each one's body does, including their own error stop lines, which only
execute on the actual abort path this file's error-scenario tests specifically trigger.
That proves each procedure genuinely runs; the header line itself just isn't attributed
a hit by gcov for these six specifically (no common dummy-argument shape distinguishes
them from this file's other, correctly-attributed procedure headers -- e.g. ts_set_civil,
same impure elemental + optional-argument shape, IS attributed normally). Treated as
the same class of line-attribution artifact as the documented end module/end submodule
exclusion in CLAUDE.md, not a real gap -- see the coverage note in feature_temporal.md.)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(out) | :: | self |
receives the parsed date (or null on caught failure). |
||
| character(len=*), | intent(in) | :: | str |
ISO-8601 date string. |
||
| logical, | intent(out), | optional | :: | success |
.true. on success; absent => abort on failure. |
Equality (aborts on a null operand).
Equality specific; see the operator(==) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Inequality (aborts on a null operand).
Inequality specific; see the operator(/=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Less-than specific; see the operator(<) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Less-or-equal specific; see the operator(<=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Greater-than specific; see the operator(>) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Greater-or-equal specific; see the operator(>=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right operand. |
Difference or day offset (aborts on a null operand / out-of-range result).
Difference specific; see the operator(-) generic. Whole days, exact; aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | a |
left (later) operand. |
||
| class(parquet_date), | intent(in) | :: | b |
right (earlier) operand. |
int32 specific of operator(-); see date_offset_days_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element to shift. |
||
| integer(kind=int32), | intent(in) | :: | n |
days to subtract. |
self shifted back by n days.
int64 specific of operator(-); see date_offset_days_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element to shift. |
||
| integer(kind=int64), | intent(in) | :: | n |
days to subtract. |
self shifted back by n days.
Day offset (aborts on a null operand / out-of-range result).
int32 specific of operator(+); see date_offset_days_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element to shift. |
||
| integer(kind=int32), | intent(in) | :: | n |
days to add. |
self shifted forward by n days.
int64 specific of operator(+); see date_offset_days_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_date), | intent(in) | :: | self |
the element to shift. |
||
| integer(kind=int64), | intent(in) | :: | n |
days to add. |
self shifted forward by n days.
type :: parquet_date private integer(int32) :: days = 0_int32 !! days since 1970-01-01 (the Parquet DATE value). logical :: valid = .false. !! .false. = null element (the default state). contains procedure :: set => date_set !! Sets from a validated (year, month, day). procedure :: get => date_get !! Returns year, month, day (aborts on null). procedure :: year => date_year !! Calendar year (aborts on null). procedure :: month => date_month !! Calendar month 1..12 (aborts on null). procedure :: day => date_day !! Day of month 1..31 (aborts on null). procedure :: is_null => date_is_null !! Whether the element is null (never aborts). procedure :: set_null => date_set_null !! Marks the element null. procedure :: set_raw => date_set_raw !! Sets the raw day count (interop; marks valid). procedure :: raw => date_raw !! Raw day count; 0 for a null element (interop). procedure, private :: date_set_mjd_i32 !! int32 specific of set_mjd. procedure, private :: date_set_mjd_i64 !! int64 specific of set_mjd. generic :: set_mjd => date_set_mjd_i32, date_set_mjd_i64 !! Sets from an integer Modified Julian Date. procedure :: to_mjd => date_to_mjd !! Integer Modified Julian Date (aborts on null). procedure :: to_string => date_to_string !! ISO-8601 "YYYY-MM-DD" (aborts on null). procedure :: parse => date_parse !! Sets from an ISO-8601 date string. procedure, private :: date_eq !! == specific. procedure, private :: date_ne !! /= specific. procedure, private :: date_lt !! < specific. procedure, private :: date_le !! <= specific. procedure, private :: date_gt !! > specific. procedure, private :: date_ge !! >= specific. generic :: operator(==) => date_eq !! Equality (aborts on a null operand). generic :: operator(/=) => date_ne !! Inequality (aborts on a null operand). generic :: operator(<) => date_lt !! Ordering (aborts on a null operand). generic :: operator(<=) => date_le !! Ordering (aborts on a null operand). generic :: operator(>) => date_gt !! Ordering (aborts on a null operand). generic :: operator(>=) => date_ge !! Ordering (aborts on a null operand). procedure, private :: date_diff !! (date, date) specific of operator(-): whole-day difference. procedure, private :: date_sub_days_i32 !! (date, integer(int32)) specific of operator(-). procedure, private :: date_sub_days_i64 !! (date, integer(int64)) specific of operator(-). procedure, private :: date_add_days_i32 !! (date, integer(int32)) specific of operator(+). procedure, private :: date_add_days_i64 !! (date, integer(int64)) specific of operator(+). generic :: operator(-) => date_diff, date_sub_days_i32, date_sub_days_i64 !! Difference or day offset (aborts on a null operand / out-of-range result). generic :: operator(+) => date_add_days_i32, date_add_days_i64 !! Day offset (aborts on a null operand / out-of-range result). end type parquet_date