HTML time tag - correct date format(HTML 时间标签 - 正确的日期格式)
问题描述
我想使用正确的格式和标准将时间标签放入我的 html 文档中.
I am wanting to use the correct format and standards to put the time tag in my html document.
这是正确的做法吗?
<time datetime="2014-03-26T12:48:42.733Z">26/03/2014</time>
谢谢
推荐答案
time
在 HTML5 中定义的元素必须以特定的机器可读格式指定时间、日期、时间和日期或其他适用的名称,如草稿.此名称可能显示为元素内容,例如
The time
element as defined in HTML5 must specify time, date, time and date, or other applicable designation in a specific machine-readable format, as described in the draft. This designation may appear as the element content, e.g.
<time>2014-03-26></time>
如果不是(通常,当内容以某种语言以人类可读的形式指定日期或时间时),机器可读的指定必须作为 datetime
属性的值出现,例如
If it does not (typically, when the content specifies a date or time in human-readable form in some language), the machine-readable designation must appear as the value of the datetime
attribute, e.g.
<time datetime="2014-03-26">26/03/2014</time>
问题中的表示法不充分,因为属性的值必须是以机器可读格式表示的元素内容",而日期和时间表示法,精确到毫秒,很难说表示日期.
The notation in the question is not adequate, as the value of the attribute must be "a representation of the element's contents in a machine-readable format", and a date and time denotation, down to milliseconds, can hardly be said to represent a date.
注意:没有证据表明浏览器或搜索引擎会使用 time
标记,因此此类标记仅具有潜在用途.
Note: There is no evidence of browsers or search engines making any use of time
markup, so such markup is only potentially useful.
这篇关于HTML 时间标签 - 正确的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:HTML 时间标签 - 正确的日期格式


基础教程推荐
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01