How to get django queryset results with formatted datetime field

后端 未结 3 1985
無奈伤痛
無奈伤痛 2021-01-18 12:14

I\'ve Django model which has foreign keys associated with other models. Each model is having same field names(attributes) created_at and updated_at

In every django q

3条回答
  •  甜味超标
    2021-01-18 12:43

    I don't think values() function would anything related to formatting datetime result. But why does that bother you? Can't you convert them to proper format when you try to display them? If you try to render them in the template, django has template filter date for formatting your datetime value: https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#date

提交回复
热议问题