In Django, how to display am / pm lowercase time in templates?

Django date / time formats have a code to display the am / pm part of the time as:

a.m.

or

AM

but not like:

AM

i.e. lowercase without periods.

How do you handle am / pm lower case?

NOTE. I thought about the answer by typing this question, so I decided that instead of breaking it, I would share my answer if he helped someone else.

+5
source share
1 answer

Use a template lowertag with a formatting tag timelike

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

displayed as

12:30pm

compared with

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

which is displayed as

12:30pm

. lower time . , .

{{object.time|time|lower}}
+11

All Articles