Skip to main content

HTML Tags

HTML <time> Tag

Written by Updated HTML <time> Tag exercises

The time tag marks a date or time so computers can read it. Readers see "2:00 PM, November 5, 2025"; search engines, calendars and scripts read the exact value 2025-11-05T14:00 from the datetime attribute.

The visible text can be written any way you like: "next Tuesday", "5 Nov", "yesterday". The datetime attribute is where the precise, standard version goes. Without it, the text inside must itself be in a valid machine format.

Syntax

html

<time datetime="YYYY-MM-DDThh:mm:ssTZD">Visible Time or Date</time>

Valid datetime formats

You meandatetime value
A date2025-11-05
A date and time2025-11-05T14:00
With a time zone (India)2025-11-05T14:00+05:30
In UTC2025-11-05T08:30Z
A month2025-11
A year2025
A time only14:00
A duration of 1 hour 30 minutesPT1H30M

Always write numbers with leading zeros (05, not 5) and the date in year-month-day order.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Time Tag Example</title>
</head>
<body>
  <h1>HTML &lt;time&gt; Tag Example</h1>
  <p>The seminar will start at <time datetime="2025-11-05T14:00">2:00 PM, November 5, 2025</time>.</p>
</body>
</html>

The page shows "2:00 PM, November 5, 2025" as normal text. The <time> tag adds no style of its own; the value is there for software.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesPartially

All current browsers support it. Since it changes nothing visually, very old browsers simply show the text.

Where it helps

  • Article publication and update dates.
  • Event dates, so tools can add them to a calendar.
  • Opening hours and durations, like a recipe's cooking time.

Search engines can read <time>, but for rich results like event listings in Google, you also need structured data (schema markup). For other machine-readable values, such as prices, see the data tag.

HTML <time> Tag exercises

Mark up a date

Show the date 1 March 2026 with the form a computer reads.

Result

Check your answer to see it here.