timeuntil Filter

Date and Time Most Useful

Argument: from_date (Optional) – the date to compare to.


Outputs the amount of time between the from_date argument, which defaults to the current time and the value.


century22 = datetime.datetime(year=2100, month=1, day=1,

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


{{ century22|timeuntil }}<br>
{{ century22|timeuntil:moon_landing }}


79 years, 8 months<br>
130 years, 5 months

The output in the browser will look like this:

79 years, 8 months
130 years, 5 months

  • The first time period is the amount of time left until the start of the 22nd century (based on the time this documentation is being written).
  • The second time period is the time between the moon landing and the start of the 22nd century.


This is commonly used to output how much time is remaining before some event takes place (e.g., Sale ends in 9 hours, 50 minutes).

Did we get something wrong? Is there a use case for the timeuntil 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