如何将 HTML 中的日期时间格式更改为 dd/mm/yyyy
How do I change format datetime in HTML to dd/mm/yyyy
例如我有这个 HTML 代码:
<div class="sub_continer">
<div class="cell">מתאריך</div>
<div class="cell">
<input placeholder="dd-mm-yyyy" type="date" id="Creation_date_R2FromId"/>
</div>
</div>
看起来像
我找不到任何方法将其更改为 dd-mm-yyyy 这种格式
(左边是日,中间是月,右边是年)
谢谢
对于 input type=date
,您无法更改值的显示方式。
The displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd
.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#value
如果您需要不同的显示,您将不得不诉诸 input type=text
。
例如我有这个 HTML 代码:
<div class="sub_continer">
<div class="cell">מתאריך</div>
<div class="cell">
<input placeholder="dd-mm-yyyy" type="date" id="Creation_date_R2FromId"/>
</div>
</div>
看起来像
我找不到任何方法将其更改为 dd-mm-yyyy 这种格式
(左边是日,中间是月,右边是年)
谢谢
对于 input type=date
,您无法更改值的显示方式。
The displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted
yyyy-mm-dd
.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#value
如果您需要不同的显示,您将不得不诉诸 input type=text
。