Time Tag in HTML5

In this article I am going to describe about the implementation and use of Time Tag in HTML5.
  • 1359

Time Tag

Many times, you may need to add time and date in your web page. HTML5 gives you ability to incorporate time on your web page using time tag. To add on a time or a date or both on a particular web page, you can use time tag that has been included in HTML5 (represented as <time>). This tag may record what a user is doing and for how long.

This element can be used as a way to encode dates and times in a machine-readable way so that, for example, user agents can offer to add birthday reminders or scheduled events to the user's calendar, and search engines can produce smarter search results.

<time> tag is new in HTML5.

Syntax

<time datetime="value">Text Here</time>

Browser Support

It is supported in all major browsers.

Attributes

  Attribute    Value                    Description
  datetime   datetime With this attribute, date and time can be defined in this element.

Example of <time> tag in HTML5

<!DOCTYPE html>

 

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta charset="utf-8" />

    <title>Time Tag in HTML5</title>

</head>

<body>

    <h2>Implementation of &lt;time&gt; Tag in HTML5</h2>

    <p>Company open at <time>08:00</time> every morning.</p>

    <p>The Timing of the meeting is <time datetime="2013-02-18">10:00am at Noida.</time></p>

    <p>The &lt;time&gt; tag does not render as anything special in any of the major browsers.</p>

</body>

</html>

 

Output

 time.html.jpg

© 2020 DotNetHeaven. All rights reserved.