HTML <Time> Tag

Dec 12, 2022
2 min read
HTML time Tag


A <time> element represents a specific date, time, or duration. It must adhere to a valid syntax. You can specify a more readable (non-valid syntax) date or time by placing a valid version in an optional datetime attribute.


<p>The shop opens at <time>22:00</time> pm.</p>

<p>I am going to the movies on <time datetime="2021-03-05 20:00">Friday</time>.</p>


  • Both the opening and closing tags are required.
  • The <time> element can be used anywhere phrasing content is expected.
  • If the <time> element has a datetime attribute, its content can be any phrasing content.
  • If the <time> element does not have a datetime attribute, its content must be a valid date or time string. It also must not contain any element descendants.
  • For details of valid datetime formats, see below.


The <time> element supports the Global Attributes, as well as the following:

  • datetime

    The datetime attribute specifies a machine-readable format of the <time> element. The value should be both:

    • A date in the Gregorian Calendar
    • A date in the proper format. See below.

Valid datetime formats

  • A valid year string
  • A valid month string
  • A valid date string
  • A valid yearless date string
  • A valid time string
  • A valid local date and time string
    <time>2021-02-18 18:23</time>
    <time>2021-02-18 18:23:47</time>
    <time>2021-02-18 18:23:47.929</time>
  • A valid time-zone offset string
  • A valid global date and time string
    <time>2021-02-18 18:23Z</time>
    <time>2021-02-18 18:23:47Z</time>
    <time>2021-02-18 18:23:47.929Z</time>
    <time>2021-02-18 18:23+0000</time>
    <time>2021-02-18 18:23:47+0000</time>
    <time>2021-02-18 18:23:47.929+0000</time>
    <time>2021-02-18 18:23+00:00</time>
    <time>2021-02-18 18:23:47+00:00</time>
    <time>2021-02-18 18:23:47.929+00:00</time>
    <time>2021-02-18 06:54-0800</time>
    <time>2021-02-18 06:54:47-0800</time>
    <time>2021-02-18 06:54:47.929-0800</time>
    <time>2021-02-18 06:54-08:00</time>
    <time>2021-02-18 06:54:47-08:00</time>
    <time>2021-02-18 06:54:47.929-08:00</time>
  • A valid week string
  • A valid duration string
    <time>4h 18m 3s</time>


Browser Support




Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet