Code has been added to clipboard!

HTML time Tag

Reading time 1 min
Published Jun 29, 2017
Updated Oct 15, 2019

HTML time: Main Tips

  • The HTML time tag is used to represent time.
  • You can define time in a time duration, an exact time on a 24-hour clock, or an exact date in the Gregorian calendar.
  • You must use both opening and closing tags.

Using the time Tag

The HTML time tag defines a specific time:

Example
<h2>The premiere show starts at <time>21:00</time> today.</h2>

It should not be used when a particular date is:

  • impossible to calculate
  • earlier than the introduction of Gregorian calendar

The datetime Attribute

The content of HTML time tag can also be made machine readable by using the datetime attribute:

Example
<h2>The premiere show starts at <time datetime="2017-07-07T21:00:00Z">21:00</time> coming Friday.</h2>

The datetime attribute value can be a representation of a time duration or a Gregorian calendar date. It allows browsers and search engines to provide a better user experience.

Browser support

Chrome
62+
Edge
All
Firefox
22+
IE
-
Opera
49+
Safari
7+

Mobile browser support

Chrome
62+
Firefox
22+
Opera
46+
Safari
4+
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>