time tag in html5 with example


  1. The <time> tag is used for declaring the date and/or time within an HTML document.
  2. 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.


Example 1 :

<html>
    <head><title>progress tag in html5</title>
    </head>
    <body>
        <p>The match is at <time>09:00</time>.</p>

<p>Metallica will visit <time datetime="2009-02-18">next Wednesday</time>.</p>

<p>Finally I reach my destination on <time datetime="2009-02-17T05:00-07:00">
    Tuesday</time>.</p>
    </body>
</html>


Demo :



In the above example, we have used time element.
  1. The first paragraph demonstrates basic usage of the <time> tag.
  2. The second paragraph shows how to use the datetime attribute in order to provide a more specific date/time than waht the tag's content provides.
  3. The third paragraph uses the datetime attribute to provide an even more specific date and time than the previous example.



0 comments:

Post a Comment