---
title: "Date and time formatting in Softr Databases"
description: "Choose how date fields display in Softr Databases, and use pattern letters such as yyyy-MM-dd in formulas to turn a date into text, with every letter listed."
canonical: "https://docs.softr.io/databases/datetime-formatting"
updated: "2026-12-04"
---

# Date and time formatting in Softr Databases

Dates show up in two places in a database: in **Date** fields, where you pick a display style, and in formulas, where you write a pattern such as `yyyy-MM-dd`. Use the display settings to match the habits of your users. Use patterns when you need an exact text, such as a label, a file name or a value for another tool.

## Format a date field

A **Date** field stores one moment in UTC. Its settings only change how Softr shows that moment.

Open the field settings. They hold these options:

![The settings of a Due date field: Show time, Display time zone with a Change default link, Date format set to Based on user locale with a Change link, Use relative time, a preview of the date, and Default date](/databases/datetime-formatting/date-field-settings.2x.webp)

| Setting                                   | What it does                                                                                                                                                                                                                 |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Show time**                             | Shows the time next to the date.                                                                                                                                                                                             |
| **Convert to user time zone**             | Shows the time in each user's time zone. Available when **Show time** is on.                                                                                                                                                 |
| **Display time zone**                     | Shows the time in one time zone for everyone. Appears when **Show time** is off, or when **Convert to user time zone** is off. The default is the default time zone of the database: select **Change default** to change it. |
| **Date format** or **Date & time format** | Shows the current format. Select **Change** to open the localization settings.                                                                                                                                               |
| **Use relative time**                     | Shows values less than a week old as "2 days ago". Older values show the full date.                                                                                                                                          |
| **Default date**                          | Fills the field when a record is created: **None**, or **Created date** (or **Created date & time** when **Show time** is on).                                                                                               |

### Choose the date style

The date style belongs to the database, not to one field. To change it, select **Change** in the field settings. You can also open the database menu and choose **Localization**.

Under **Date & time format**, choose one of three options:

- **Based on user locale**: each user sees the format their browser prefers. This is the default.
- **Custom**: you choose every part of the format.
- A language and region, such as English (United States): you choose a **Style** of **Short**, **Medium** or **Long**.

With **Custom**, you set these options:

| Setting           | Choices                                                                     |
| ----------------- | --------------------------------------------------------------------------- |
| **Date format**   | **Friendly** (Jul 10, 2004), **MM DD YYYY**, **DD MM YYYY**, **YYYY MM DD** |
| Separator         | `-`, `/` or `.`. Appears for every date format except **Friendly**.         |
| **Time format**   | **12 hours** (02:30 PM) or **24 hours** (14:30)                             |
| **Start week on** | **Monday**, **Saturday** or **Sunday**                                      |

The settings show a preview of the result. For number and currency formats, see [Field types](/databases/field-types).

## Format a date in a formula

The `DATETIME_FORMAT` function turns a date into text with a pattern. The pattern is a list of letters, and each letter stands for one part of the date.

```plain
DATETIME_FORMAT({Due Date}, "MMM d, yyyy")
```

The result is text, so it no longer works as a date. Keep the date field for sorting and filtering, and use the text for display.

`DATETIME_PARSE` uses the same patterns in the other direction. It reads a text such as `12/31/2025` with the pattern `MM/dd/yyyy` and returns a date. For both functions, see [Formula reference](/databases/formulas).

### Common patterns

For the date July 10, 2004, 14:30:

| Pattern                 | Result              |
| ----------------------- | ------------------- |
| `yyyy-MM-dd`            | 2004-07-10          |
| `MM/dd/yyyy`            | 07/10/2004          |
| `MMM d, yyyy`           | Jul 10, 2004        |
| `MMMM d, yyyy`          | July 10, 2004       |
| `EEEE`                  | Saturday            |
| `HH:mm`                 | 14:30               |
| `h:mm a`                | 2:30 PM             |
| `yyyy-MM-dd'T'HH:mm:ss` | 2004-07-10T14:30:00 |

A date without a time counts as midnight. `HH:mm` on such a date returns `00:00`.

> **Warning**
>
> Letters are case-sensitive. `MM` is the month and `mm` is the minute. `yyyy` is the year and `YYYY` is the week-based year, which gives the wrong year for dates in the first or last days of January and December. `dd` is the day of the month and `DD` is the day of the year.

## Pattern letters

Softr formulas use the Java date pattern syntax (`DateTimeFormatter` in Java 21).

| Letter     | Meaning                            | Example                |
| ---------- | ---------------------------------- | ---------------------- |
| `G`        | Era                                | AD                     |
| `y`        | Year of era                        | 2004; 04               |
| `u`        | Year                               | 2004; 04               |
| `Y`        | Week-based year                    | 2004                   |
| `M` or `L` | Month                              | 7; 07; Jul; July       |
| `Q` or `q` | Quarter                            | 3; 03; Q3; 3rd quarter |
| `w`        | Week of the week-based year        | Depends on the locale  |
| `W`        | Week of the month                  | Depends on the locale  |
| `D`        | Day of the year                    | 192                    |
| `d`        | Day of the month                   | 10                     |
| `E`        | Day of the week, as text           | Sat; Saturday          |
| `e` or `c` | Day of the week, as number or text | Depends on the locale  |
| `a`        | AM or PM                           | PM                     |
| `H`        | Hour of the day, 0 to 23           | 14                     |
| `h`        | Hour of AM or PM, 1 to 12          | 2                      |
| `K`        | Hour of AM or PM, 0 to 11          | 2                      |
| `k`        | Hour of the day, 1 to 24           | 14                     |
| `m`        | Minute                             | 30                     |
| `s`        | Second                             | 55                     |
| `S`        | Fraction of a second               | 978                    |
| `A`        | Millisecond of the day             | 52200000               |
| `n`        | Nanosecond of the second           | 987654321              |
| `N`        | Nanosecond of the day              | 52200000000000         |

Time zone letters (`V`, `z`, `O`, `X`, `x`, `Z`) do not work. Softr formulas hold dates without a time zone, so a pattern with one of these letters leaves the cell empty. To show another time zone, use `SET_TIMEZONE` first.

## How letter counts work

The number of times you repeat a letter changes the result.

| Kind           | Rule                                                                                        | Example                                             |
| -------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| Text           | 1 to 3 letters give the short form, 4 give the full form, 5 give the first letter.          | `MMM` gives Jul, `MMMM` gives July, `MMMMM` gives J |
| Number         | One letter gives the number as it is. More letters pad the number with zeros to that width. | `d` gives 5, `dd` gives 05                          |
| Number or text | 3 or more letters give text. Fewer give a number.                                           | `M` gives 7, `MM` gives 07                          |
| Year           | Two letters give the last two digits. Four letters give the full year.                      | `yy` gives 04, `yyyy` gives 2004                    |
| Fraction       | Each letter adds one digit of the fraction of a second, from 1 to 9.                        | `SSS` gives 978                                     |

These limits apply: `d`, `H`, `h`, `K`, `k`, `m` and `s` take up to two letters, and `D` takes up to three.

## Text and special characters

- Put literal text between single quotation marks: `yyyy-MM-dd'T'HH:mm`. Quote every letter you want to keep as it is.
- Write two single quotation marks to output one: `''`.
- Characters that are not letters, such as `-`, `/`, `:`, `,` and a space, appear as they are.
- Square brackets `[` and `]` mark an optional part, used when reading text with `DATETIME_PARSE`.
- The characters `#`, `{` and `}` are reserved. Do not use them.
- An unknown letter, or a letter repeated too many times, leaves the cell empty.

## Related

[**Formula reference**](/databases/formulas)

Every formula function, including date functions.

[**Field types**](/databases/field-types)

How the Date field works next to the other field types.
