[Fixed]-In Django, how to display times with lowercase am/pm in templates?

32👍

Use the lower template tag with the time formatting tag, e.g.

{{object.time|time:"g:iA"|lower}}

renders as

12:30pm

compared to

{{object.time|time:"g:iA"}}

which renders as

12:30PM

Note simply using the lower filter on a time object without the explicit time format filter doesn’t work. But you can use the default time format, e.g.

{{object.time|time|lower}}

Leave a comment