---
updatedAt: 2026-05-21T07:05:22.000Z
agentTools:
  projectIndex: https://help.zluri.com/llms.txt
---

# Date Formatting in Notification Templates

Notification email templates support a `formatDate` helper that lets users control how dates appear in emails. Use this helper to display dates in a variety of styles by combining tokens. You can show or hide the time, use full or abbreviated month names, switch between 12-hour and 24-hour format, and more.

## How to use it

Place the helper anywhere in a template where a date should appear:

```
{{formatDate <date_variable> "<format>"}}
```

* **`<date_variable>`** – The date value from the notification data (for example, `end_date`, `created_at`).
* **`"<format>"`** – A format string you build using the tokens listed below, wrapped in double quotes. To use the default format, omit this argument entirely.

> **Important:** Don't add extra spaces inside the format string. `"MMM DD, YYYY"` is correct. `"MMM  DD,  YYYY"` produces unexpected spacing in the output.

## Available format tokens

These are the building blocks you combine to produce the date style you want. Everything else in the format string—separators like `/`, `-`, `:`, spaces, and commas—appears exactly as written.

| Token  | Output                         | Example    |
| ------ | ------------------------------ | ---------- |
| `YYYY` | Full 4-digit year              | `2024`     |
| `YY`   | Last 2 digits of the year      | `24`       |
| `MMMM` | Full month name                | `March`    |
| `MMM`  | Abbreviated month name         | `Mar`      |
| `DD`   | Day of the month (01–31)       | `05`, `15` |
| `HH`   | Hour in 24-hour format (00–23) | `00`, `14` |
| `hh`   | Hour in 12-hour format (01–12) | `01`, `02` |
| `mm`   | Minutes (00–59)                | `00`, `45` |
| `ss`   | Seconds (00–59)                | `00`, `30` |
| `A`    | AM/PM indicator                | `AM`, `PM` |

> **Note:** Use `hh` and `A` together. Using `hh` alone displays the 12-hour number without an AM/PM label.

## Examples

All examples use the date **March 15, 2024, 10:30:45 AM UTC**.

### Example 1: Default style

Both of the following produce the same output. Use whichever is cleaner in your template.

```
{{formatDate end_date}}
```

**Output:**

```
Mar 15, 2024
```

### Example 2: Full month name

Use the complete month name for a more formal appearance.

```
{{formatDate end_date "MMMM DD, YYYY"}}
```

**Output:**

```
March 15, 2024
```

### Example 3: Compact numeric date

Use a slash-separated format for dense content areas.

```
{{formatDate end_date "DD/MM/YYYY"}}
```

**Output:**

```
15/03/2024
```

### Example 4: Date with 24-hour time

Include the full time when precision matters, such as in deadline or audit notifications.

```
{{formatDate end_date "DD MMM YYYY HH:mm:ss"}}
```

**Output:**

```
15 Mar 2024 10:30:45
```

### Example 5: Date with 12-hour time and AM/PM

Use a 12-hour format for customer-facing emails.

```
{{formatDate end_date "MMM DD, YYYY hh:mm A"}}
```

**Output:**

```
Mar 15, 2024 10:30 AM
```

## Quick reference: Common patterns

| Style                          | Format string            | Output                  |
| ------------------------------ | ------------------------ | ----------------------- |
| Default                        | `""` or omit entirely    | `Mar 15, 2024`          |
| Full month, full year          | `"MMMM DD, YYYY"`        | `March 15, 2024`        |
| Short month, short year        | `"MMM DD, YY"`           | `Mar 15, 24`            |
| Numeric (DD/MM/YYYY)           | `"DD/MM/YYYY"`           | `15/03/2024`            |
| Numeric (YYYY-MM-DD)           | `"YYYY-MM-DD"`           | `2024-03-15`            |
| Date + 24-hour time            | `"DD MMM YYYY HH:mm"`    | `15 Mar 2024 10:30`     |
| Date + 12-hour time with AM/PM | `"MMM DD, YYYY hh:mm A"` | `Mar 15, 2024 10:30 AM` |

## Behavior on invalid or missing dates

| Scenario                            | What appears                  |
| ----------------------------------- | ----------------------------- |
| Date value is empty or not provided | Nothing (blank)               |
| Date value can't be parsed          | The raw value                 |
| Format string is `""` or omitted    | Default style: `Mar 15, 2024` |