所以我有一本叫做 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/