---
title: "age function in Strata | Oplema"
description: "Calculate the time between two timestamps as an interval, subtracting the second from the first. Use it in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/age"
updated: "2026-11-04"
---

# age

Calculate the time between two timestamps as an interval, subtracting the second from the first.

## Try an expression

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

### Expression

```
age(TIMESTAMP '2001-04-10', TIMESTAMP '1992-09-20')
```

### Result

```
'8 years 6 months 20 days'
```

The expression returns `INTERVAL`. Formula stores it as `VARCHAR` in this example. 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 | 8 years 6 months 20 days |

## Arguments and types

```
age(timestamp, timestamp)
```

**timestamp**

Timestamp

Supported signatures (4)

```
age(timestamp: TIMESTAMP WITH TIME ZONE) → INTERVAL
age(timestamp: TIMESTAMP WITH TIME ZONE, timestamp: TIMESTAMP WITH TIME ZONE) → INTERVAL
age(timestamp: TIMESTAMP) → INTERVAL
age(timestamp: TIMESTAMP, timestamp: TIMESTAMP) → INTERVAL
```

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

[date\_diff

Count the unit boundaries crossed between two dates or timestamps. For example, January 31 to February 1 crosses one month boundary.

](https://oplema.com/docs/strata/functions/date-diff)[date\_sub

Count the complete units between two dates or timestamps. For example, January 31 to February 1 is zero complete months. Also available as datesub.

](https://oplema.com/docs/strata/functions/date-sub)[extract

Extract a date or time component such as the year.

](https://oplema.com/docs/strata/functions/extract)[generate\_series

Create a list of values from start to stop, including stop. Start defaults to 0 and step defaults to 1.

](https://oplema.com/docs/strata/functions/generate-series)

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

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