Warning:
This wiki has been archived and is now read-only.

Elements/time

From HTML Wiki
Jump to: navigation, search

The <time> element represents either a time on a 24 hour clock, or a precise date in the calendar, optionally with a time and a time-zone offset.

Point

  • This element is intended as a way to encode modern dates and times in a machine-readable way so that, for example, user agents can offer to add birthday reminders or scheduled events to the user's calendar.
  • The time element is not intended for encoding times for which a precise date or time cannot be established. For example, it would be inappropriate for encoding times like "one millisecond after the big bang", "the early part of the Jurassic period", or "a winter around 250 BCE".

HTML Attributes

  • datetime = date or time
    Specifies the date or time that the element represents. Any one of the following:
    • a date
    • a time
    • a date and time
  • pubdate = "pubdate" or "" (empty string) or empty
    Indicates that the date and time given by the element is the publication date and time of the nearest ancestor article element — or, if the element has no ancestor article element, of the document as a whole.

See also global attributes.


Examples

Example A

[try it]

<p>
On <time datetime="1913-03-12">12 March 1913</time>, the city of Canberra
was officially given its name by Lady Denman, the wife of Governor-General
Lord Denman.
</p>


HTML Reference

This element was introduced in HTML5 - 4.6.9 The time element.