Skip to main content
Scalar function
Aliases: to_unix_timestamp NULL timestamp, value or format yields NULL. Invalid string/timezone conversion raises an error.

Syntax

Unix timestamp timestamp (scalar)

Unix timestamp parsed (scalar)

Arguments

Unix timestamp timestamp

Unix timestamp parsed

Returns

  • Type: BIGINT
  • NULL behavior: NULL timestamp, value or format yields NULL. Invalid string/timezone conversion raises an error.

Properties

Units

  • Input unit: Timestamp or formatted text
  • Output unit: Signed seconds since Unix epoch UTC
  • Microseconds / 1000000, truncating toward zero.

Usage notes

  • Fractional seconds are truncated toward zero, including negative epoch values.
  • Pass a TIMESTAMP, or pass a STRING together with its format. An unformatted STRING is not part of these calling forms.

Examples

Alias calling form: UNIX_TIMESTAMP

Unix epoch and one second later

This example uses UTC.

Limitations

  • TO_UNIXTIME accepts a TIMESTAMP. The STRING-with-format, DATE, unformatted STRING, and no-argument forms are not available through this alias.
Last modified on October 15, 2026