2.7 Text-Level Semantics—More New Tags 31
interpret ruby and visually separate it. A browser without ruby support would
display the examples as 北 běi 京 jěng and HTML N°5 (Web Standard).
2.7.2 The “time” Element
The time element represents either a time in the 24-hour-format or a date in the
Gregorian calendar with optional time and time-zone components. Its purpose
is to give modern date and time specifications in a machine-readable format
within an HTML5 document. Vague time references, such in the spring of 2011
or five minutes before the turn of the millennium, are therefore not allowed.
To ensure machine readability, we can use the attribute datetime, and its attri-
bute value can be specified either as time, date, or a combination of both. The
syntax for specifying the time components is clearly defined in the specification
and is described in Table 2.1.
Table 2.1 The Rules for Timestamps for the “time” Element’s “datetime” Attribute
Component Syntax Example
Date YYYY-MM-DD 2011-07-13
Time with hours hh:mm 18:28
Time with seconds hh:mm:ss 18:28:05
Time with milliseconds hh:mm:ss.f 18:28:05.2318
Date and time T to join date and
time
2011-07-13T18:28
With time zone GMT Z at the end 2011-07-13T18:28:05Z
With time zone as offset +mm:hh / -mm:hh 2011-07-13T18:28:05+02:00
The pubdate attribute is a boolean attribute and indicates that the specified date
applies to the next level article in the hierarchy, and—if there is none—should
be understood as the publication date of the document. If you are using pubdate,
there has to be a datetime element as well. If this is not the case, the section be-
tween the time element’s start tag and end tag must contain a valid date.