I am somehow confused how to properly markup the following example:
The course takes 2 days
from Sunday, 12.06.2014 9:00-18:00
to Monday, 13.06.2014 9:00-14:00
I came up with the following but i am uncertain if that is the correct proper way:
<p>The course takes <time datetime="P 2 D">2 days</time></p>
<p> from <time datetime="2014-06-12">Sunday, 12.06.2014 </time><time datetime="2014-06-12T9:00+1:00">9:00</time>-<time datetime="2014-06-12T18:00+1:00">18:00</time></p>
<p> to <time datetime="2014-06-13">Monday, 13.06.2014 </time><time datetime="2014-06-13T9:00+1:00">9:00</time>-<time datetime="2014-06-13T14:00+1:00">14:00</time></p>
The
time
element represents its contents, along with a machine-readable form of those contents in thedatetime
attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations.
Semantically your markup is ok.
However, there are few issues with datetime
attribute:
P 2 D
--> P2D
.2014-06-12T9:00+1:00
--> 2014-06-12T09:00+01:00
.After fix:
<p>The course takes <time datetime="P2D">2 days</time></p>
<p> from <time datetime="2014-06-12">Sunday, 12.06.2014 </time><time datetime="2014-06-12T09:00+01:00">9:00</time>-<time datetime="2014-06-12T18:00+01:00">18:00</time></p>
<p> to <time datetime="2014-06-13">Monday, 13.06.2014 </time><time datetime="2014-06-13T09:00+01:00">9:00</time>-<time datetime="2014-06-13T14:00+01:00">14:00</time></p>