Django的模板date格式
我有数据库中的isoformatdate,但是当date传递到模板,它出现了像Oct. 16, 2011 。 
无论如何,我可以操纵格式到任何我想要的?
 date 
 settings.DATE_FORMAT 
 在你的模板中,你可以使用Django的datefilter。 例如: 
 <p>Birthday: {{ birthday|date:"M d, Y" }}</p> 
得到:
生日:1983年1月29日
datefilter文档中的更多格式示例。
  设置DATE_FORMAT和USE_L10N 
要在Django 1.4.1中对整个站点进行更改,请添加:
 DATE_FORMAT = "Ymd" 
 到你的settings.py文件并编辑: 
 USE_L10N = False 
 因为l10n会覆盖DATE_FORMAT 
这是logging在: https : //docs.djangoproject.com/en/dev/ref/settings/#date-format
为了在views.py中更改date格式,然后将其分配给模板。
 # get the object details home = Home.objects.get(home_id=homeid) # get the start date _startDate = home.home_startdate.strftime('%m/%d/%Y') # assign it to template return render_to_response('showme.html' {'home_startdate':_startDate}, context_instance=RequestContext(request) )