【发布时间】:2020-03-15 07:49:18
【问题描述】:
In my model i have a fields like :
时间 = models.DateTimeField(auto_now_add=True)
In view page i am getting the value like in this format :
2020-03-15T11:07:07.089Z
I am getting the date time in this format.
{{ result.time|naturaltime }}
但它不工作它返回我来自数据库的同一日期
【问题讨论】:
-
大家有什么建议吗???一个
-
你的问题不清楚,你到底想做什么。添加更多详细信息,我们将为您提供帮助:3
-
@M3duZa 我的问题是我正在以这种格式获取日期:2020-03-15T11:07:07.089Z 如何在 2020 年 3 月 15 日上午 07:07 进行转换
-
你可以试试
auto_now_add,而不是auto_now。
标签: python django django-admin