Used to format the date and time of a datetime or date object.
The format argument can be constructed using format strings or one of the following predefined formats:
DATE_FORMATDATETIME_FORMATSHORT_DATE_FORMATSHORT_DATETIME_FORMAT
Variable
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.
