TO_UNIXTIME

All functions > DATE AND TIME > TO_UNIXTIME

Returns a unix timestamp (BIGINT representation of the number of seconds since 1970-01-01 00:00:00 UTC) from the given timestamp.

Signatures

Returns: Unix timestamp as DECIMAL (seconds since epoch)

TO_UNIXTIME(timestamp: TIMESTAMP) → DECIMAL
sql
ParameterTypeRequiredDescription
timestampTIMESTAMPYesA TIMESTAMP value to convert

Notes

  • Converts TIMESTAMP to Unix epoch seconds
  • Returns seconds since January 1, 1970 00:00:00 UTC
  • Result is a DECIMAL to preserve sub-second precision
  • Useful for interoperability with systems using Unix timestamps
  • Inverse of FROM_UNIXTIME
Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19