Skip to main content
Scalar function
Aliases: to_unix_timestamp Returns NULL for a NULL timestamp.

Syntax

To unixtime timestamp (scalar)

  • TO_UNIXTIME accepts exactly one TIMESTAMP operand. It does not support an omitted argument or STRING parsing.

Arguments

Returns

  • Type: BIGINT
  • NULL behavior: Returns NULL for a NULL timestamp.

Properties

Units

  • Input unit: Timestamp
  • 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 one TIMESTAMP argument. To parse formatted text, use TO_UNIX_TIMESTAMP.

Examples

Alias calling form: TO_UNIXTIME

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