Anonymous contributor's avatar
Anonymous contributor
Anonymous contributor's avatar
Anonymous contributor
Published Nov 8, 2021Updated Nov 8, 2021
Contribute to Docs

The <time> semantic HTML element represents a time-related piece of information, including:

  • A specific date in the Gregorian calendar.
  • The time on a 24-hour clock.
  • A valid time duration. The <time> element accepts a datetime attribute that translates the info to a machine-readable format.


<!-- Date and/or time info goes inside the tag -->

The <time> element requires opening and closing tags that wrap around a block of text.

Its datetime attribute should be in a valid format for it to be translated to machine-readable info, see below examples.


Using the <time> element inside of another element:

Our flight is scheduled on
<time datetime="2021-12-20">December 20th, 2021</time> at
<time datetime="18:00">6:00pm</time>.

All contributors

Looking to contribute?

Learn HTML on Codecademy