time HTML

HTML <time> Tag

To define date and time in a 24-hour clock or a precise date in the Gregorian calendar, the HTML <time> tag is used. It thus encodes the value of date and time in a machine-readable format. Thus making it easy to mark or to schedule a task and also to produce smarter search results. It was introduced in HTML5.

Syntax:

<time>Date and Time value</time>

Example:

<!DOCTYPE html> <html> <body> <h3>Schedule:</h3> <p><time>10:00</time> AM - Meeting at Conference Hall.</p> <p><time datetime="2019-10-10 23:55">Tom's Birthday</time>.</p> </body> </html>

Output:

Explanation:

In the above example, we have defined date and time using the HTML <time> tag.

Tag specific Attributes:

 Attribute Value Uses datetime datetime Used to specify a machine-readable date/time of the HTML

Global Attributes:

The HTML Global attributes are supported by the HTML <time> tag.

Event Attributes:

The HTML Event attributes are supported by the HTML <time> tag.

Supporting Browser:

Chrome, IE, Firefox, Opera and Safari.