Shape · Dates and time

Convert Date/Time to Text

Turns a date into text using a pattern, such as 01/03/2024 or Mar 2024. The result is text, so use it for labels and exports, not for date math.

Also known as: Date format, strftime

How it works

Each format row names a column, a pattern and an optional output column. Pick a pattern from the presets or type your own with the tokens YYYY, YY, MM, DD, HH, hh, mm, ss, MMM, MMMM and A (AM/PM); a raw strftime pattern such as %d/%m/%Y also works. Leave the output blank to overwrite the column in place, which turns it into text, or name a new column to keep the date. A text column holding ISO dates is accepted too. Rows with no column or no pattern are ignored. If you only want dates to print differently in a report, use Format Table instead.

Inputs and outputs

Inputs

  • data — Table

Outputs

  • data — Table

Settings

The Attributes panel of Convert Date/Time to Text, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
formats: [{ column: string, pattern: string, outputColumn?: string }]  // pattern = a strftime format (DuckDB strftime), e.g. "%d/%m/%Y" gives 01/03/2024 and "%b %Y" gives Mar 2024; the result is text

Example

You want a month label for a chart while keeping order_date for sorting. Add a format: column order_date, pattern MMM YYYY, output month_label.

order_datemonth_label
2024-03-01Mar 2024
2024-11-15Nov 2024