MeridianMERIDIAN

Calendar Year

datetime.component.yearwas datetime.year in v1

Four-digit year. Ambiguous as a standalone value — could be any integer. Column-mode inference checks range and distribution.

Casts to
SMALLINT
Scope
broad_numbers

Shape

Pattern
^\d{4}(\.0+)?$
ValueLengthShape
20244matches
19994matches
20004matches
2023rejected: one character short

Background

Origin

ISO 8601 requires a year to be written with at least four digits, covering the years 0000 to 9999.[1] The first edition of ISO 8601 was published as ISO 8601:1988 in June 1988.[1] ISO 8601 says that year values from 0000 through 1582 shall only be used by mutual agreement of the partners in information interchange.[1]

The Year 2000 problem arose because many programs represented four-digit years with only the final two digits, making the year 2000 indistinguishable from 1900.[2] The four-digit year is the plain lesson of that episode: two digits save space and leave the century to guesswork. (Meridian's view)

W3C's XML Schema datatypes specification defines gYear as a datatype that represents Gregorian calendar years.[3] The Frictionless Data Table Schema defines a year field type as a calendar year as per XMLSchema gYear.[4] The Frictionless Data Table Schema gives YYYY as the usual lexical representation of a year field, with no format options.[4]

Use

MySQL has a YEAR type, a 1-byte type used to represent year values.[5] MySQL displays YEAR values in YYYY format, with a range of 1901 to 2155, and 0000.[5] MySQL converts two-digit year strings from '0' to '69' into the years 2000 to 2069, and strings from '70' to '99' into 1970 to 1999.[5] A two-digit year in a source file is a guess about the century, so find out which pivot rule produced or will read it before you trust it. (Meridian's view)

The pandas documentation explains that because NaN is a float, an array of integers with any missing values is forced to become floating point.[6] If a year column reads 2024.0, suspect a float conversion somewhere upstream and drop the fraction before casting the column to a whole number. (Meridian's view)

A four-digit number on its own could just as well be a count, a code or a price, so check a column's name and its range of values before treating it as a year. (Meridian's view)

Where you'll meet it

Our World in Data's life expectancy CSV download carries a year column of four-digit values such as 1950, beside entity, code and life expectancy columns.[7]

Detection notes

v1 name: datetime.year. Was designation: duplicate.

Use it

CLI · DuckDB
$ finetype infer -i "2024" --mode column
→ datetime.component.year

SELECT ft_infer('2024');
-- → 'datetime.component.year'
Cast expression
{col}::SMALLINT

Schema

https://meridian.online/schemas/datetime.component.year · Frictionless type year

finetype taxonomy datetime.component.year -o json-schema

Type Registry