Is it correct to use the <time> tag for displaying dates in HTML5
Is it correct this code for displaying a date?开发者_Go百科
<time class="entry-date" datetime="2010-09-27T10:50:15+00:00" pubdate>27/09/2010</time>
Yup - that's correct. Have a look at this draft spec to see the valid date time strings: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#global-dates-and-times.
Your time represents 27th September 2010, 3:00pm UTC.
Yes, that is the one you should use according to:
http://www.w3schools.com/html5/html5_reference.asp
The tag defines a time or a date, or both.
Yes, it's both syntactically and semantically correct:
- The
time
tag should be used to define a date and/or time - The syntax of the
datetime
attribute is correct and passes W3C:s HTML5 validator - The
pubdate
attribute is also fine, assuming that thetime
tag is inside anarticle
tag and that thetime
tag actually specifies the publication time of the article
精彩评论