I have dates in ISO 8601 format in the database, %Y-%m-%d
. However, when the date is passed on to the template, it comes out as something like Oct. 16, 2011
.
有没有什么方法可以让我随心所欲地操纵格式?
I have dates in ISO 8601 format in the database, %Y-%m-%d
. However, when the date is passed on to the template, it comes out as something like Oct. 16, 2011
.
有没有什么方法可以让我随心所欲地操纵格式?
在模板中,可以使用Django的date
过滤器.例如.:
<p>Birthday: {{ birthday|date:"M d, Y" }}</p>
提供:
生日:1983年1月29日
更多格式示例请参见date filter docs.