# epoch — DuckDB 1.4.4

Extract the epoch component from a temporal type

- Reference: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/
- JSON: /products/haybarn/functions/api/v1/duckdb-1.4.4/functions/epoch.json
- Snapshot ID: duckdb-1.4.4
- Engine: duckdb v1.4.4
- Source ID: 6ddac802ff
- Binary SHA-256: 8d05bee013ea13d6b5d75272d7ddb52b3d6d9cdaf30d1a3e8e82d42757905182
- Captured: 2026-09-05T18:37:36.091Z
- Source: https://github.com/duckdb/duckdb/releases/tag/v1.4.4
- Loaded extensions: autocomplete, core_functions, icu, json, parquet, shell

## Interpretation

- Choose a snapshot matching the target engine and build. The default is captured from the published Haybarn WASM package used by the browser playground. Historical native snapshots are also available.
- Availability is an observation in the recorded build and extension profile, not a guarantee of support in every installation or in WASM.
- Types and descriptions are declarations from duckdb_functions(). Binding can specialize result types. Null means not supplied by the catalog; do not invent defaults, optionality, argument mode, or table output columns.
- Raw parameter arrays preserve catalog order for scalar/aggregate/macro functions. Raw table arguments are alphabetical. Use callingConvention for engine-confirmed positional order and named arguments; null modes are unrecorded. Named does not mean optional. Macro defaults and special named variadic behavior are not supplied by duckdb_functions().
- Catalog examples are source material and may require data or extensions. runnableExamples contains separately verified SQL for the pinned WASM package; sample-data adaptations and guide examples are labeled separately.
- Guide annotations and recipes are separate editorial content. The browser runner always uses Haybarn WASM 1.5.5-rc3, independently of the documentation snapshot.
- All URLs beginning with / are relative to the origin hosting this document. Exports require no JavaScript, cookies, API key, or browser engine.

## Overloads

### overload-6c9b2b2bb22b4524

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: DATE) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-6c9b2b2bb22b4524

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | DATE | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-7b4ef8b3d63766d8

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: INTERVAL) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-7b4ef8b3d63766d8

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | INTERVAL | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-c0e47898f7a94f03

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: TIME) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-c0e47898f7a94f03

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | TIME | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-bca451820a1611d8

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: TIME WITH TIME ZONE) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-bca451820a1611d8

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | TIME WITH TIME ZONE | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-667e6678f8e55110

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: TIME_NS) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-667e6678f8e55110

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | TIME_NS | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-44e753dbbb48979d

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: TIMESTAMP) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-44e753dbbb48979d

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | TIMESTAMP | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.

### overload-67d948b460e927f4

Kind: scalar. Parameter order: catalog-order.

```text
epoch(temporal: TIMESTAMP WITH TIME ZONE) → DOUBLE
```

Link: /products/haybarn/functions/releases/duckdb-1.4.4/epoch/#overload-67d948b460e927f4

| Argument | Catalog type | Calling mode |
| --- | --- | --- |
| temporal | TIMESTAMP WITH TIME ZONE | not recorded |

Declared return type: DOUBLE. Variadic argument type: none declared.
Stability: CONSISTENT. Declared side effects: false.


## Guide recipes

No guide recipes.

## Engine catalog examples

Source examples may require additional data or extensions. Expressions are wrapped in SELECT; execution verification is not recorded.

Reported for: overload-6c9b2b2bb22b4524, overload-7b4ef8b3d63766d8, overload-c0e47898f7a94f03, overload-bca451820a1611d8, overload-667e6678f8e55110, overload-44e753dbbb48979d, overload-67d948b460e927f4

```sql
SELECT epoch(timestamp '2021-08-03 11:59:44.123456');
```

## Runnable examples

Executed successfully in Haybarn WASM 1.5.5-rc3. Sample data and guide examples are separate from the original catalog.

```sql
SELECT epoch(timestamp '2021-08-03 11:59:44.123456');
```

## Additional DuckDB documentation

- [Date Part Functions](https://duckdb.org/docs/current/sql/functions/datepart#epochdate)
- [Interval Functions](https://duckdb.org/docs/current/sql/functions/interval#epochinterval)
- [Timestamp Functions](https://duckdb.org/docs/current/sql/functions/timestamp#epochtimestamp)

## In other engines

### Apache Hive: unix_timestamp()



Apache Hive:

```sql
UNIX_TIMESTAMP(x)
```

Haybarn / DuckDB:

```sql
EPOCH(STRPTIME(x, '%Y-%m-%d %H:%M:%S'))
```

Translation from [SQLGlot](https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_hive.py#L485).

### Apache Spark: unix_timestamp()



Apache Spark:

```sql
SELECT UNIX_TIMESTAMP('2016-1-1', 'yyyy-M-d')
```

Haybarn / DuckDB:

```sql
SELECT EPOCH(STRPTIME('2016-1-1', '%Y-%-m-%-d'))
```

Translation from [SQLGlot](https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_spark.py#L720).

### BigQuery: unix_seconds()



BigQuery:

```sql
SELECT UNIX_SECONDS('2008-12-25 15:30:00+00')
```

Haybarn / DuckDB:

```sql
SELECT CAST(EPOCH(CAST('2008-12-25 15:30:00+00' AS TIMESTAMPTZ)) AS BIGINT)
```

Translation from [SQLGlot](https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_bigquery.py#L3081).

### Presto: to_unixtime()



Presto:

```sql
TO_UNIXTIME(x)
```

Haybarn / DuckDB:

```sql
EPOCH(x)
```

Translation from [SQLGlot](https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_duckdb.py#L1952).

### Snowflake: date_part()



Snowflake:

```sql
SELECT DATE_PART(epoch_second, foo) as ddate from table_name
```

Haybarn / DuckDB:

```sql
SELECT CAST(EPOCH(foo) AS BIGINT) AS ddate FROM table_name
```

Translation from [SQLGlot](https://github.com/tobymao/sqlglot/blob/3086608e6fd4c41c02dfba47171608d2b193fce2/tests/dialects/test_snowflake.py#L3723).

## Observed availability

| Snapshot | Observed | Overloads | JSON |
| --- | --- | --- | --- |
| haybarn-1.5.5-rc3 | present | 7 | [reference](/products/haybarn/functions/api/v1/haybarn-1.5.5-rc3/functions/epoch.json) |
| duckdb-1.5.5 | present | 7 | [reference](/products/haybarn/functions/api/v1/duckdb-1.5.5/functions/epoch.json) |
| duckdb-1.4.4 | present | 7 | [reference](/products/haybarn/functions/api/v1/duckdb-1.4.4/functions/epoch.json) |
| duckdb-1.3.2 | present | 6 | [reference](/products/haybarn/functions/api/v1/duckdb-1.3.2/functions/epoch.json) |

Engine catalog documentation is derived from MIT-licensed Haybarn and DuckDB. [Notices](/third-party-notices.txt).
