---
title: '|date'
description: for formatting dates.
date: '2026-08-02'
categories:
  - Filter
  - Date and Time
canonical: https://www.djangotemplatetagsandfilters.com/filters/date/
doc_link: https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#date
---

# |date

for formatting dates.

## Documentation

Used to format the date and time of a `datetime` or `date` object.

The `format` argument can be constructed using [format strings](https://docs.djangoproject.com/en/6.0/ref/templates/builtins/#std:templatefilter-date) or one of the following predefined formats:

1. `DATE_FORMAT`
2. `DATETIME_FORMAT`
3. `SHORT_DATE_FORMAT`
4. `SHORT_DATETIME_FORMAT`

### Variable

```django
moon_landing = datetime.datetime(year=1969, month=7, day=21,
        hour=2, minute=56, second=15,
        tzinfo=datetime.timezone.utc)
```

### Sample Formats

- `{{ moon_landing }}` – July 21, 1969, 2:56 a.m.
- `{{ moon_landing|date }}` – July 21, 1969
- `{{ moon_landing|date:'l, F j, Y' }}` – Monday, July 21, 1969
- `{{ moon_landing|date:"DATE_FORMAT" }}` – July 21, 1969
- `{{ moon_landing|date:"DATETIME_FORMAT" }}` – July 21, 1969, 2:56 a.m.
- `{{ moon_landing|date:"SHORT_DATE_FORMAT" }}` – 07/21/1969
- `{{ moon_landing|date:"SHORT_DATETIME_FORMAT" }}` – 07/21/1969 2:56 a.m.

Note that the predefined formats are based on the current locale.
