Skip to main content

TO_UNIX_TIMESTAMP

Converts a timestamp in a date/time format to a Unix timestamp format. A Unix timestamp represents the number of seconds that have elapsed since January 1, 1970, at 00:00:00 UTC.

Syntax

TO_UNIX_TIMESTAMP(<expr>)

Arguments

ArgumentsDescription
<expr>Timestamp

For more information about the timestamp data type, see Date & Time.

Return Type

BIGINT

Examples

SELECT
to_unix_timestamp('2023-11-12 09:38:18.165575');

┌─────────────────────────────────────────────────┐
│ to_unix_timestamp('2023-11-12 09:38:18.165575')
├─────────────────────────────────────────────────┤
1699781898
└─────────────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today