jump

HTML: The Markup Language (an HTML language reference)

timedate and/or time NEW # T

The time element represents a date and/or time.

Permitted contents #

Permitted attributes #

global attributes
Any attributes permitted globally.
datetime (any) = time-datetime #
Specifies the date or time that the element represents.
Any one of the following:
  • a month
  • a date
  • a yearless date which must consist of the following parts in exactly the following order:
    1. a valid date-month as defined in [RFC 3339]
    2. The literal string "-".
    3. a valid date-mday as defined in [RFC 3339]

    Example:

    11-12
  • a time
  • a local date and time
  • a valid time-offset as defined in [RFC 3339]

    Examples:

    Z
    +0000
    +00:00
    -0800
    -08:00
  • a date and time
  • a week
  • a valid date-fullyear as defined in [RFC 3339], with the additional qualification it must be four or more digits representing a number greater than 0

    Examples:

    2011
    0001
  • a valid duration string as defined in the [HTML5] specification

    Examples:

    PT4H18M3S
    4h 18m 3s

Additional constraints and admonitions #

Tag omission #

A time element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain phrasing elements

Details #

If the datetime (any) attribute is not specified, then the date or time represented is given by the contents of the element, and the character data in those contents must conform to the time-datetime datatype.

DOM interface #

interface HTMLTimeElement : HTMLElement {
           attribute DOMString datetime (any);
};