HTML


The <time> element in HTML is used to set and display date and time on a webpage. This tag introduced in HTML5.

Following is the attribute −

  • datetime: The date-time to be displayed.

Let us now see an example to implement the <time> tag in HTML −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Schedule</h2>
<p>Exams begins from next <time datetime="06-15">Saturday</time>.</p>
<p>Exam begins at <time>09:00</time> in the morning.</p>
</body>
</html>

Output

In the above example, we have set the date and time using the <time> element −

<p>Exams begins from next <time datetime="06-15">Saturday</time>.</p>

To set only the time, use the <time> element as shown below −

<p>Exam begins at <time>09:00</time> in the morning.</p>

Updated on: 30-Jul-2019

25 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements