开发者

django template date filter format string question

开发者 https://www.devze.com 2023-01-23 12:45 出处:网络
I have a datetime value that is available in a django 开发者_如何转开发template. I am trying to format the date as \"d-mmm\"

I have a datetime value that is available in a django 开发者_如何转开发template.

I am trying to format the date as "d-mmm"

so for example dates are formated as:

  • 5-Mar
  • 10-Mar
  • 4-Apr

etc.

I have tried different combinations - NOTHING works so far?. I hope I dont have to write a custom filter just to format a date ?

[Edit]

I tried the 'obvious' format string like: 'j-M', 'j-N', (even 'j-mmm' and 'd-mmm')


Have you tried {{ some_date|date:"j-M" }}?

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date

0

精彩评论

暂无评论...
验证码 换一张
取 消