Localized date strftime in Django view

后端 未结 1 472
[愿得一人]
[愿得一人] 2021-02-01 13:31

I would like to send localized date in JSON from django view

Normal text translation via

ugettext

is OK

Following

1条回答
  •  礼貌的吻别
    2021-02-01 14:20

    Finally i used date filter from django templates:

    from django.template.defaultfilters import date as _date
    from datetime import datetime
    
    _date(datetime.now(), "d b, D")
    

    0 讨论(0)
提交回复
热议问题