bwbrowning bwbrowning - 4 months ago 18
Python Question

Django datetimefield time in template

I have a

in one of my models

If I display
{{ model.datetime }}
in the template, I see:

Aug. 13, 2013, 7:57 p.m.

If I display
{{ model.datetime.time }}
in the template , I see:

2:57 am

I want it to just display
7:57 p.m.
How can I get it to use the correct timezone. I have tried with
as well but with the same result.



{{ model.datetime|date:"g:i a" }}

If you want a different format, refer to the documentation here