Documentation

    epoch_ms

    Get the milliseconds since 1970-01-01 for a date or timestamp. Given a whole number of milliseconds, it returns the matching timestamp instead.

    Try an expression

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

    Expression

    epoch_ms(TIMESTAMP '2021-08-03 11:59:44.123456')

    Result

    1627991984123

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

    Arguments and types

    epoch_ms(temporal)
    temporal
    Number, Date, Interval, Time, Timestamp
    Supported signatures (8)
    epoch_ms(temporal: BIGINT) → TIMESTAMP
    epoch_ms(temporal: DATE) → BIGINT
    epoch_ms(temporal: INTERVAL) → BIGINT
    epoch_ms(temporal: TIME WITH TIME ZONE) → BIGINT
    epoch_ms(temporal: TIME) → BIGINT
    epoch_ms(temporal: TIMESTAMP WITH TIME ZONE) → BIGINT
    epoch_ms(temporal: TIMESTAMP) → BIGINT
    epoch_ms(temporal: TIME_NS) → BIGINT

    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.