---
title: "epoch function in Strata | Oplema"
description: "Get the number of seconds since 1970-01-01 from a date or timestamp, for simple duration math. For example, epoch(INTERVAL 5 HOUR) returns 18000.0."
url: "https://oplema.com/docs/strata/functions/epoch"
updated: "2026-11-04"
---

# epoch

Get the seconds since 1970-01-01 for a date or timestamp, or the total seconds in an interval.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **DOUBLE**.

### Expression

```
epoch(INTERVAL 5 HOUR)
```

### Result

```
18000.0
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 18000 |

## Arguments and types

```
epoch(temporal)
```

**temporal**

Date, Interval, Time, Timestamp

Supported signatures (7)

```
epoch(temporal: DATE) → DOUBLE
epoch(temporal: INTERVAL) → DOUBLE
epoch(temporal: TIME WITH TIME ZONE) → DOUBLE
epoch(temporal: TIME) → DOUBLE
epoch(temporal: TIMESTAMP WITH TIME ZONE) → DOUBLE
epoch(temporal: TIMESTAMP) → DOUBLE
epoch(temporal: TIME_NS) → DOUBLE
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[epoch\_ms

Get the milliseconds since 1970-01-01 for a date or timestamp. Given a whole number of milliseconds, it returns the matching timestamp instead.

](https://oplema.com/docs/strata/functions/epoch-ms)[epoch\_ns

Extract the epoch component in nanoseconds from a temporal type.

](https://oplema.com/docs/strata/functions/epoch-ns)[epoch\_us

Extract the epoch component in microseconds from a temporal type.

](https://oplema.com/docs/strata/functions/epoch-us)[century

Get the century from a date or timestamp, such as 20 for 1992.

](https://oplema.com/docs/strata/functions/century)

[Browse dates & times](https://oplema.com/docs/strata/functions#dates-&-times) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/interval.html#epochinterval)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
