Meridianmeridian

Calendar Quarter

datetime.period.quarter

Calendar quarter notation (Q1-Q4 with year). Ubiquitous in SEC filings, earnings data, and business intelligence dashboards. Represents a 3-month range. Transforms to first day of the quarter.

Domain
datetime
Category
period
Casts to
DATE
Scope
Universal

Try it

CLI
$ finetype infer -i "Q1 2024"
→ datetime.period.quarter

DuckDB

Detect
SELECT finetype('Q1 2024');
-- → 'datetime.period.quarter'
Cast expression
make_date(CAST(regexp_extract({col}, '(\d{4})') AS INT), (CAST(regexp_extract({col}, 'Q([1-4])') AS INT) - 1) * 3 + 1, 1)
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS DATE) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'datetime.period.quarter';

Struct Expansion

Expression
quarter: CAST(regexp_extract({col}, 'Q([1-4])') AS INT)
year: CAST(regexp_extract({col}, '(\d{4})') AS INT)

JSON Schema

finetype schema datetime.period.quarter
{
  "$id": "https://meridian.online/schemas/datetime.period.quarter",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Calendar quarter notation (Q1-Q4 with year). Ubiquitous in SEC filings, earnings data, and business intelligence dashboards. Represents a 3-month range. Transforms to first day of the quarter.",
  "examples": [
    "Q1 2024",
    "Q4 2023",
    "2024-Q2",
    "2023 Q3"
  ],
  "pattern": "^(Q[1-4]\\s?\\d{4}|\\d{4}[\\s-]?Q[1-4])$",
  "title": "Calendar Quarter",
  "type": "string",
  "x-finetype-broad-type": "DATE",
  "x-finetype-transform": "make_date(CAST(regexp_extract({col}, '(\\d{4})') AS INT), (CAST(regexp_extract({col}, 'Q([1-4])') AS INT) - 1) * 3 + 1, 1)"
}

Examples

Q1 2024Q4 20232024-Q22023 Q3

Aliases

quarter_iso