# Convert to and from epoch numbers

Shape / columns

A variant of [Parse a date or time](https://meridian.online/operations/parse-a-date-or-time).

Turn a Unix epoch number into a timestamp, or a timestamp into one.

Page: <https://meridian.online/operations/parse-a-date-or-time/convert-to-and-from-epoch-numbers>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

turn an epoch number into a timestamp and back

```sql
CREATE TEMP TABLE result AS
SELECT to_timestamp(1700000000) AT TIME ZONE 'UTC' AS from_seconds, epoch_ms(1700000000000) AS from_millis,
       epoch(TIMESTAMP '2023-11-14 22:13:20') AS to_seconds, epoch_ms(TIMESTAMP '2023-11-14 22:13:20') AS to_millis;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT from_seconds = TIMESTAMP '2023-11-14 22:13:20' AND from_millis = TIMESTAMP '2023-11-14 22:13:20' AND to_seconds = 1700000000 AND to_millis = 1700000000000 FROM result)) THEN 'as expected' ELSE error('1700000000 was not 2023-11-14 22:13:20 in both directions') END AS verdict;
```

The statement builds its own data.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- Duckle: [`Epoch Convert`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Ibis: [`ExtractEpochSeconds`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- Ibis: [`TimestampFromUNIX`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- KNIME Analytics Platform: [`UNIX Timestamp to Date&Time`](https://api.hub.knime.com/nodes/*uWOA5VCC8225r1HD?details=full) (read 2026-09-27)
- Polars: [`from_epoch`](https://docs.pola.rs/api/python/stable/reference/expressions/functions.html) (read 2026-09-27)
- RapidMiner Studio: [`Numerical to Date`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/numerical_to_date.html) (read 2026-09-27)
