我的 Django 会议记录被读取为一个月?
My Django minutes being read reads as month?
你好,我一直在开发一个倒数计时器帐户,我制作了如下代码(遵循教程):
{% for time in timer %}
<p id="tm" style="margin-top:-8px;margin-bottom:20px;display:none;">{{time.time|date:"M d, Y H:m:s"}}</p>
{% endfor %}
我已将时钟小部件中的计时器设置为 03:50,但是当我通过 javascript
console.log 时
const timeLength = documents.getElementById('tm');
console.log(timeLength.textContent)
它打印 03:12,总是读作月份而不是分钟。
但是分钟总是被设置为月份,
而且我已经确定 M(大写)应该代表月份,而 m(小写)代表分钟,对吧?我哪里做错了?卡在这里几天了,从我做的google的研究来看,总是说M是月,m是分..
提前谢谢你。
And I am already sure that M (uppercase) supposed to represent month, and the m (lowercase) represents the minute, right??
否。日期说明符类似于 PHP 的日期格式化程序。作为 documentation section on the date format says:
Format character
Description
Example Output
m
Month, 2 digits with leading zeros.
'01'
to '12'
(…)
(…)
(…)
M
Month, textual, 3 letters.
'Jan'
(…)
(…)
(…)
i
Minutes.
'00'
to '59'
您因此使用 i
分钟:
{{ time.time|date:<b>"M d, Y H:i:s"</b> }}
你好,我一直在开发一个倒数计时器帐户,我制作了如下代码(遵循教程):
{% for time in timer %}
<p id="tm" style="margin-top:-8px;margin-bottom:20px;display:none;">{{time.time|date:"M d, Y H:m:s"}}</p>
{% endfor %}
我已将时钟小部件中的计时器设置为 03:50,但是当我通过 javascript
const timeLength = documents.getElementById('tm');
console.log(timeLength.textContent)
它打印 03:12,总是读作月份而不是分钟。
但是分钟总是被设置为月份,
而且我已经确定 M(大写)应该代表月份,而 m(小写)代表分钟,对吧?我哪里做错了?卡在这里几天了,从我做的google的研究来看,总是说M是月,m是分..
提前谢谢你。
And I am already sure that M (uppercase) supposed to represent month, and the m (lowercase) represents the minute, right??
否。日期说明符类似于 PHP 的日期格式化程序。作为 documentation section on the date format says:
Format character | Description | Example Output |
---|---|---|
m |
Month, 2 digits with leading zeros. | '01' to '12' |
(…) | (…) | (…) |
M |
Month, textual, 3 letters. | 'Jan' |
(…) | (…) | (…) |
i |
Minutes. | '00' to '59' |
您因此使用 i
分钟:
{{ time.time|date:<b>"M d, Y H:i:s"</b> }}