python - How to display localized time from datetime in django template -
to brief. next_contact
utc datetime when write in template
{{ event.next_contact }}
i localized date , time in place want output time do:
{{ event.next_contact.time }}
and non localized time
how fix it??
use {{ event.next_contact|localtime|date:"h:i" }}
. if have set use_tz=true
can skip localtime
filter.
as of django 1.7 when passed datetime value attached timezone information (a time-zone-aware datetime instance) time
filter accept timezone-related format specifiers 'e', 'o' , 't' , 'z'.
Comments
Post a Comment