# to_timestamp

Converts UINT256 seconds since the Unix epoch to a timezone-naive TIMESTAMP. Interpret the result as UTC when the source value is an EVM block timestamp.

Canonical HTML: <https://determica.com/docs/functions/to_timestamp>

- Kind: scalar function
- Category: [EVM utilities](/docs/category/evm-utilities.md)
- Tags: Types, EVM

Converts UINT256 seconds since the Unix epoch to a timezone-naive TIMESTAMP. Interpret the result as UTC when the source value is an EVM block timestamp.

## Overload 1: to_timestamp(UINT256)

```sql
to_timestamp(UINT256)
```

Converts unsigned Unix seconds to TIMESTAMP. Values above INT64_MAX return NULL; values within INT64 that exceed the supported TIMESTAMP conversion range can raise a Conversion Error.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `unix_seconds` (UINT256; required; positional) — UINT256 whole seconds since 1970-01-01 00:00:00. NULL returns NULL.

### Returns

SQL timestamp

Returns a timezone-naive TIMESTAMP. Values above INT64_MAX return NULL; other out-of-range conversions may throw.

- `timestamp` (TIMESTAMP)

SQL timestamp. Returns a timezone-naive TIMESTAMP. Values above INT64_MAX return NULL; other out-of-range conversions may throw.

## Additional examples

```sql
-- Interpret an EVM block timestamp as UTC
SELECT to_timestamp(1700000000::UINT256)::VARCHAR AS block_time;
-- => [{"block_time":"2023-11-14 22:13:20"}]
```

```sql
-- A large timestamp that still converts successfully
SELECT to_timestamp(253402300799::UINT256)::VARCHAR AS upper_example;
-- => [{"upper_example":"9999-12-31 23:59:59"}]
```
