# Work with durations

Shape / columns

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

Parse, format, decompose and compute on durations and intervals as values of their own.

Page: <https://meridian.online/operations/parse-a-date-or-time/work-with-durations>

## Status

Runs as a SQL step.

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

## The DuckDB step

parse, decompose and compute on durations

```sql
CREATE TEMP TABLE result AS
SELECT CAST('1 day 2 hours 30 minutes' AS INTERVAL) AS parsed, CAST('90 minutes' AS INTERVAL) AS ninety,
       date_part(['day', 'hour', 'minute'], CAST('1 day 2 hours 30 minutes' AS INTERVAL)) AS parts,
       CAST('1 day 2 hours 30 minutes' AS INTERVAL) * 2 AS doubled,
       epoch(INTERVAL '2 hours 30 minutes') AS seconds,
       CAST(CAST('1 day 2 hours 30 minutes' AS INTERVAL) AS VARCHAR) AS shown;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT parsed = INTERVAL '1 day 2 hours 30 minutes' AND ninety = INTERVAL 90 MINUTE AND parts = {'day': 1, 'hour': 2, 'minute': 30} AND doubled = INTERVAL '2 days 5 hours' AND seconds = 9000 AND shown = '1 day 02:30:00' FROM result)) THEN 'as expected' ELSE error('a duration was not parsed, decomposed, doubled, counted in seconds and written out as expected') 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).

- DuckDB: [`Interval Functions (family)`](https://duckdb.org/docs/current/sql/functions/interval) (read 2026-09-27)
- Ibis: [`IntervalAdd`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- Ibis: [`IntervalFloorDivide`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- Ibis: [`IntervalFromInteger`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- Ibis: [`IntervalMultiply`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- Ibis: [`IntervalSubtract`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/temporal.py) (read 2026-09-27)
- KNIME Analytics Platform: [`Duration (Time-based) to Number`](https://api.hub.knime.com/nodes/*LSdmfw3bvWcDSlm2?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Duration Part Extractor`](https://api.hub.knime.com/nodes/*CqubuamAlzYoI76y?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Duration to String`](https://api.hub.knime.com/nodes/*mB2RAUPk7GC9iGFn?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String to Duration`](https://api.hub.knime.com/nodes/*pDssMDFTGau1fLQV?details=full) (read 2026-09-27)
- Power Query M: [`Duration functions`](https://learn.microsoft.com/en-us/powerquery-m/duration-functions) (read 2026-09-27)
