Documentation

    extract

    Extract a date or time component such as the year.

    Try an expression

    In Formula, enter the expression and set Output type to BIGINT.

    Expression

    extract('year' FROM DATE '2024-03-15')

    Result

    2024

    To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    extract(field FROM timestamptz)

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    A missing date

    extract('year' FROM NULL::DATE)

    NULL

    Browse dates & timesDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.