Documentation

    epoch

    Get the seconds since 1970-01-01 for a date or timestamp, or the total seconds in an interval.

    Try an expression

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

    Expression

    epoch(INTERVAL 5 HOUR)

    Result

    18000.0

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

    Arguments and types

    epoch(temporal)
    temporal
    Date, Interval, Time, Timestamp
    Supported signatures (7)
    epoch(temporal: DATE) → DOUBLE
    epoch(temporal: INTERVAL) → DOUBLE
    epoch(temporal: TIME WITH TIME ZONE) → DOUBLE
    epoch(temporal: TIME) → DOUBLE
    epoch(temporal: TIMESTAMP WITH TIME ZONE) → DOUBLE
    epoch(temporal: TIMESTAMP) → DOUBLE
    epoch(temporal: TIME_NS) → DOUBLE

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

    Things to know

    If the first argument is missing, the result is NULL.

    Browse dates & timesDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.