Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Time HTML时间标记-正确的日期格式_Time_Tags_Html - Fatal编程技术网

Time HTML时间标记-正确的日期格式

Time HTML时间标记-正确的日期格式,time,tags,html,Time,Tags,Html,我想使用正确的格式和标准,把时间标签在我的html文档 这是正确的方法吗 <time datetime="2014-03-26T12:48:42.733Z">26/03/2014</time> 26/03/2014 感谢根据以下内容: [RFC 3339]中定义的有效日期和时间,以及以下附加条件: 日期/时间语法中的文字字母T和Z必须始终为大写 全年生产日期定义为四位或更多数字,表示大于0的数字 示例: 1990-12-31T23:59:60Z 1996-12-1

我想使用正确的格式和标准,把时间标签在我的html文档

这是正确的方法吗

<time datetime="2014-03-26T12:48:42.733Z">26/03/2014</time>
26/03/2014
感谢

根据以下内容:

[RFC 3339]中定义的有效日期和时间,以及以下附加条件:

  • 日期/时间语法中的文字字母T和Z必须始终为大写
  • 全年生产日期定义为四位或更多数字,表示大于0的数字
示例:

1990-12-31T23:59:60Z

1996-12-19T16:39:57-08:00


格式为
YYYY-MM-DDThh:MM:ssTZD

指定的日期或时间。部件说明:

YYYY - year (e.g. 2011)
MM - month (e.g. 01 for January)
DD - day of the month (e.g. 08)
T - a required separator if time is also specified
hh - hour (e.g. 22 for 10.00pm)
mm - minutes (e.g. 55)
ss - seconds (e.g. 03)
TZD - Time Zone Designator (Z denotes Zulu, also known as Greenwich Mean Time)
所以是的

是,请参见,规范规定了格式。没有提到分数时间,所以不,这是不正确的

但是,这是正确的:

<time datetime="2014-03-26T12:48:42Z">26/03/2014</time>
26/03/2014
HTML5中定义的元素必须以特定的机器可读格式指定时间、日期、时间和日期,或其他适用的名称,如草案中所述。该名称可能显示为元素内容,例如

<time>2014-03-26></time>
问题中的符号是不够的,因为属性的值必须是“以机器可读的格式表示元素的内容”,并且日期和时间表示(以毫秒为单位)很难说是表示日期

注意:没有证据表明浏览器或搜索引擎使用了
时间
标记,因此此类标记仅可能有用。

请查看以下链接:
<time datetime="2014-03-26">26/03/2014</time>