更新时间:2023-12-03 20:18:40
看看 timesince 模板过滤器。它是内置的。
Have a look at the timesince template filter. It's builtin.
以下内容返回现在和 comment_date
之间的人性化差异(例如 8小时'
):
The following returns a humanized diff between now and comment_date
(e.g. '8 hours'
):
{{ comment_date|timesince }}
以下内容返回 question_date
和之间的人性化差异comment_date
:
{{ comment_date|timesince:question_date }}