Code Example

In that code example, the time element tells the browser that the text “Tuesday at 8:00 AM” is a reference to time. The datetime element is not shown to the user but is used by the browser to relay the same information as what is contained in the text content of the time element.

Using time

The time element is used to tell a browser that the associated text is time-related. In-and-of itself, that doesn’t do a lot for users or browsers, although it may be a help to users of some assistive technologies. The time element isn’t particularly useful until paired with a datetime attribute. One a datetime attribute has been associated with the time element, the browser knows a lot more about the time described in the time element and can use that information when interacting with other applications — such as when importing information from an HTML email or webpage into a calendar application.

The datetime attribute can be used to identify a year, a month and year, a specific date, a date and time, a time without a date, and durations of time.