> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TO_UNIXTIME

> Returns the number of seconds since the Unix epoch for a timestamp.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`to_unix_timestamp`](/query/sql/functions/date-time/to_unix_timestamp)

Returns NULL for a NULL timestamp.

## Syntax

### To unixtime timestamp (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
to_unixtime(value)
```

* TO\_UNIXTIME accepts exactly one TIMESTAMP operand. It does not support an omitted argument or STRING parsing.

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | TIMESTAMP | Yes | Instant to convert to epoch seconds. |

## Returns

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

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Exact result | Yes |

## 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](/query/sql/functions/date-time/to_unix_timestamp).

## Examples

### Alias calling form: TO\_UNIXTIME

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT to_unixtime(TIMESTAMP '2024-01-01 00:00:00') AS result;
```

| result |
| - |
| 1704067200 |

### Unix epoch and one second later

This example uses UTC.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT to_unixtime(TIMESTAMP '1970-01-01 00:00:00') AS epoch, to_unixtime(TIMESTAMP '1970-01-01 00:00:01') AS one_second;
```

| epoch | one\_second |
| - | - |
| 0 | 1 |

## Limitations

* TO\_UNIXTIME accepts a TIMESTAMP. The STRING-with-format, DATE, unformatted STRING, and no-argument forms are not available through this alias.

## Related functions

* [from\_unixtime](/query/sql/functions/date-time/from_unixtime)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.