gpt4 book ai didi

python - 如何将秒转换为 hh :mm:ss in django template

转载 作者:行者123 更新时间:2023-12-01 07:34:19 25 4
gpt4 key购买 nike

所以我有一本叫做 match 的字典。其中包含比赛的详细信息,其中一个键是 game_time。如果比赛时间<= 10,则比赛处于选秀阶段。另外,我想报告游戏时间,但它存储的值只是以秒为单位。


{% if match.game_time <= 10 %}
drafting
{% else %}
{{match.game_time|date: "Z"}}
{% endif %}

只是给我一个错误

Could not parse the remainder: ': "Z"' from 'match.game_time|date: "Z"'

感谢任何帮助

最佳答案

使用此格式表示时间

{{your_date_field|time:"h:i a"}}

关于python - 如何将秒转换为 hh :mm:ss in django template,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57067120/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com