HTML <time> Tag

The <time> tag is new in HTML5.

The <time> tag defines a readable date and time.

This element is used to present dates and times in a machine readable format. It is useful for user agents to offer event scheduling for user's calendar.

Syntax

The <time> tag comes in pairs. The content must be written between opening (<time>) and closing (</time>) tags.

Example

<!DOCTYPE html>
<html>
   <body>
      <p>The game will start at <time>19:00</time>.</p>
   </body>
</html>

Result


Let's see another example with "datetime" attribute:

<!DOCTYPE html>
<html>
   <body>
      <p>The game will be held on <time datetime="2014-09-28 19:00">September 28</time>.</p>
   </body>
</html>

Result


The datetime attribute doesn't render anything special in major browsers.

Attributes

Attribute Value Description
datetime datetime Creates a machine-readable date and time of <time> element.

The <time> element also supports the Global Attributes.