html tutorial - <time> tag in HTML - html5 - html code - html form



  • <time> tag is used to define the human readable time and date.
  • <time> tag represents a 24-hour clock time and date.
  • <time> tag is able to encode the date and time in machine readable format.
  • <time> tag supports Global and event attributes.
  • <time> tag belongs to Flow content, phrasing content and palpable content.

Syntax for <time> tag:

<time>content</time>

Difference between HTML4.01 and HTML 5 for

HTML 4.01:

  • The HTML4 is does not support

HTML 5:

  • The HTML5 is support

Sample Coding for <time> tag:

Tryit<!DOCTYPE html>
<html >
    <head>
        <title>Wikitechy time tag</title>
    </head>
    <body>
        <h2>HTML time tag with example. </h2> 
        <p>The time is<time datetime="17:30">05.30 pm</time>.</p>
    </body>
</html>

Code Explanation for <time> tag:

code explanation for time tag

  1. The <time> tag is used to define time in the document.
  2. The “datetime” attribute is used to define date time in the machine-readable format.
  3. The "05.30 pm” will be visible to human in the browser.

Output of <time> tag:

output for time tag

  1. The output shows the “The time is 5.30 pm.”

Attributes of <time> tag:

Attribute Value HTML 4 HTML 5 Description
datetime datetime No Yes It is indicating a machine-readable time and date of the

Browser Support for <time> tag:

6.0 9.0 4.0 5.0 11.1

Related Searches to time tag in html