HTML5: Marking up date and time with the <time> element

This entry is part 14 of 34 in the series HTML5

If we have a date and time in a web page and we want to pass this date and time to a calendar through a script, we can use the <time> element so that time is written in a way readable by human.

Also, with the <time> element, we can specify a time with a format that can be understood by the calendar script.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title> - HTML 5</title>

    <p>Live performance is set at this date <time pubdate datetime='2014-06-10T20:00'>June 10, 2014</time></p>


So in the above HTML, the human will see June 10, 2014 and the machine will see 2014-06-10T20:00.

Series Navigation<< HTML5: Marking images with <figure> and <figcaption>
HTML5: Hightlighting text with the <mark> element >>

Leave a comment

Leave a Reply