A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

User:Matthew Raymond/date element

From WHATWG Wiki
Jump to: navigation, search

Date elements are used to provide date values for Web Forms 2.0 compliant user agents, and to provide a means for those same dates to be displayed in HTML 4.01 compliant browsers.

The date information provided by the date element can be used for scheduling purposes, or for any other date-related purposes. The actual data is contained in the element's value attribute.


<date value="2005-01-25">25-Jan-2005</date>


In the above example, the suggested rendering on a Web Forms 2.0 compliant user agent would be the date contained in value in a localized format. For example, the browser may render "January 25th, 2005". Alternatively, it would also be valid to render the child contents of the element, with the localized date displayed as a tooltip. The second rendering, however, is not recommended.

The child contents of a date element are intended for legacy user agent support. Although they can be used by a Web Forms 2.0 compliant browser, the primary intent is that a localized date value be rendered in the place of the contents.

If the value attribute of a date element is not specified, the user agent must check to see if the child contents are a text string containing an ISO 8601 formatted date, and if so, the value of the value attribute should default to that of the child contents.


<date>2010-02-14</date>


The above example may be rendered as "February 14th, 2010", or some other localized date string.