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
| Parameter | Type | Required | Description |
|---|---|---|---|
timestamp | TIMESTAMP | Yes | A 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
On this page