time Filter

Date and Time Most Useful

Argument: format (Optional) – a format string.


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


moon_landing = datetime.datetime(year=1969, month=7, day=21,
        hour=2, minute=56, second=15,

Sample Formats

  • {{ moon_landing }} – July 21, 1969, 2:56 a.m.
  • {{ moon_landing|time }} – 2:56 a.m.
  • {{ moon_landing|time:'G:i:s'}} – 02:56:15 a.m.


If you want output both the date and time, use the date filter instead.

Did we get something wrong? Is there a use case for the time filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on Oct. 30, 2022, 1:21 p.m. EST