HTML Element <time> Example

The HTML element <time> is used to define a specific time or DateTime, like birthdays and anniversaries.

The attribute datetime can be used to translate the time into a machine-readable format, which can be used by browsers and search engines as below.

  • The browsers can use them to add date reminders to the user's calendar.
  • The search engines can use them to produce smarter search results.

Here is an example that explains the element in action. Click the below link to see the live demo.

Run this on IDE

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example - HTML Element time</title>
</head>
<body>
    <p>The food court opens from <time>10:00</time> to <time>21:00</time> everyday.</p>
    <p>I have a date on <time datetime="2010-12-14 19:00">Valentines day</time>.</p>
</body>
</html>

Related Links