How to modify the date and time format in DateTimeField Django

When html page read DateTimeField fields from the database, format and time format stored in the database is inconsistent, such as database fields content 2019-09-27 13:00:00, but the page is displayed Apr. 03, 2017 , 1 pm

In order to display matching pages and databases, page formatting time necessary, to add {{infor.updatetime | date: "Ymd H: i: s"}} similar filters. Refresh the page to display properly.

E.g:

{{ article.publish_date }}>

Read:

{{ article.publish_date|date:"Y-m-d H:i:s" }}

Guess you like

Origin www.cnblogs.com/wanghuijie1/p/11599983.html