---
title: "strftime function in Strata | Oplema"
description: "Format a date or timestamp as text using a format string such as %d/%m/%Y. For example, strftime(DATE '2024-03-15', '%Y-%m') returns '2024-03'."
url: "https://oplema.com/docs/strata/functions/strftime"
updated: "2026-11-04"
---

# strftime

Format a date or timestamp as text using a format string such as %d/%m/%Y.

## Try an expression

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

### Expression

```
strftime(DATE '2024-03-15', '%Y-%m')
```

### Result

```
'2024-03'
```

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 | 2024-03 |

## Arguments and types

```
strftime(data, format)
```

**data**

Date, Timestamp, Text

**format**

Date, Timestamp, Text

Supported signatures (8)

```
strftime(data: DATE, format: VARCHAR) → VARCHAR
strftime(data: TIMESTAMP WITH TIME ZONE, format: VARCHAR) → VARCHAR
strftime(data: TIMESTAMP, format: VARCHAR) → VARCHAR
strftime(data: TIMESTAMP_NS, format: VARCHAR) → VARCHAR
strftime(data: VARCHAR, format: DATE) → VARCHAR
strftime(data: VARCHAR, format: TIMESTAMP WITH TIME ZONE) → VARCHAR
strftime(data: VARCHAR, format: TIMESTAMP) → VARCHAR
strftime(data: VARCHAR, format: TIMESTAMP_NS) → VARCHAR
```

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

## Things to know

Format strings control the output. %Y is the four-digit year and %m is the two-digit month.

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

## Related functions

[strptime

Parse text into a timestamp using a format string such as %d/%m/%Y. Text that doesn't match raises an error; use try\_strptime to get a missing value instead.

](https://oplema.com/docs/strata/functions/strptime)[try\_strptime

Parse text into a timestamp using a format string such as %d/%m/%Y. Text that doesn't match returns a missing value instead of an error.

](https://oplema.com/docs/strata/functions/try-strptime)[century

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

](https://oplema.com/docs/strata/functions/century)[date\_add

Move a date or timestamp forward or backward by an interval.

](https://oplema.com/docs/strata/functions/date-add)

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

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