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 时间标签 - 正确的日期格式


- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01