Skip to: content, navigation

by Ian Lloyd

datetime (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support full matrix
IE7 FF2 Saf3 Op9.5
None None None None
datetime="datetime"

Example

The datetime attribute is used below in both the del and ins elements:

<p>Bernie enjoyed nothing more than a <del
    cite="http://berniesworld.com/drag.html"
    datetime="2007-11-05T23:31:05Z">night out on the town at his
    favorite drag queen show</del> <ins
    cite="http://berniesworld.com/drag.html"
    datetime="2007-11-05T23:33:32Z">quiet night in with a warm cup of
    cocoa</ins>
</p>

Description

The datetime attribute contains the time stamp that reflects the time and date at which the change was made to the content using the ins or del elements. This attribute must be formatted precisely, right down to the minute and second.

Value

The datetime attribute is defined as follows (using the ISO8601 date format):

YYYY-MM-DDThh:mm:ssTZD

Here’s what the various components mean:

  • YYYY: year (e.g. 2007)
  • MM: month (e.g. 11 for November)
  • DD: day of the month (e.g. 05)
  • T: required character, a separator
  • hh: hour (e.g. 23 for 11.00pm)
  • mm: minutes (e.g. 31)
  • ss: seconds (e.g. 05)
  • TZD: Time Zone Designator (Z, which appears in the example HTML above, denotes Zulu, better known as Greenwich Mean Time.)

Compatibility

None of the browsers in the support chart do anything useful with the datetime attribute. It would be possible to use DOM scripting to retrieve this information for some purpose, but natively, the most that any of the browsers we tested can do is shown in the Firefox screenshot in Figure 1. To access this information, I had to right-click on the text and select Properties from the menu that displayed.

Figure 1. datetime information as discovered in Firefox Firefox showing ins and del attributes in properties

Given that no visual clue is provided to indicate that the ins and del content has anything extra to reveal, few people would ever discover this information. And even if they did, the URI of the document isn’t clickable, nor is the date formatted in a friendly way.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters