🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

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
DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

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

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

Mobile browser support

Browser image
Chrome
62+
Browser image
Firefox
22+
Browser image
Opera
46+
Browser image
Safari
4+