问题描述
我正在我的网页上使用HTML5元素。默认情况下,输入 type =date
显示日期为 YYYY-MM-DD
。 问题是可以将其格式更改为: DD-MM-YYYY
?
无法更改格式
我们必须区分线上格式和浏览器的演示格式。
线格式 HTML5日期输入规范[1]是指RFC3339规范[2],其规定了等于yyyy-mm-dd的全日格式。有关更多详细信息,请参见RFC3339规范的第5.6节。
演示文稿格式浏览器在显示日期输入方面不受限制。在撰写Chrome [3]和Microsoft Edge时,有最广泛的日期支持。它们使用用户的本地日历格式显示日期选择器。 Opera 10.6+还显示日期选择器,但以线格式显示日期。其他浏览器,如Firefox 51.0.1和Internet Explorer 9/10/11显示带有格式的文本输入字段。
参考文献
I'm working with HTML5 elements on my webpage. By default input type="date"
shows date as YYYY-MM-DD
.
The question is, is it possible to change it's format to something like: DD-MM-YYYY
?
There is no way possible to change the format
We have to differentiate between the over the wire format and the browser's presentation format.
Wire format The HTML5 date input specification [1] refers to the RFC3339 specification [2], which specifies a full-date format equal to: yyyy-mm-dd. See section 5.6 of the RFC3339 specification for more details.
Presentation format Browsers are unrestricted in how they present a date input. At the time of writing Chrome [3] and Microsoft Edge have the most extensive date support. They displays a date picker using the user's local calendar format. Opera 10.6+ also displays a date picker, but shows the date in the wire format. Other browsers, such as Firefox 51.0.1 and Internet Explorer 9/10/11 display a text input field with the wire format.
References
- http://www.w3.org/TR/html-markup/input.date.html
- http://tools.ietf.org/html/rfc3339
- https://plus.google.com/102860501900098846931/posts/hTcMLVNKnec
这篇关于有没有办法改变输入类型=“日期”格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!