The time tag (<time>) defines extra semantic information like time (24 hour format) or date (with or without time zone offset) in a web page. The time element of HTML5 does not render anything, so it won’t make any difference in the output. But it encodes the date and time in a way that can be read by web browsers and generates smarter search results produced by search engines.
Important point need to be remembered:
- HTML5 time element is supported by latest versions of all web browsers. Internet Explorer 8 or earlier versions of Internet Explorer do not support time element.
There is a HTML5 time element example given below:
Our shop is opened at <time>10:00</time> every morning.
The HTML5 time element has an attribute ‘datetime’. In the following examples I would like to show that how to use ‘datetime’ attribute in the time element.
<time datetime="2012-11-25">25<sup>th</sup> November</time>
<time datetime="18:00">starts at 6pm</time>
<time datetime="2012-11-25T18:00+00:00">6pm on the festival day</time>
When the datetime attribute is used with the HTML5 time element that time the content can be anything.