Search w3schools.com:

SHARE THIS PAGE

HTML <time> datetime Attribute

HTML time Tag Reference HTML <time> tag

Example

A time element with a date specified:

<p>I have a date on <time datetime="2008-02-14">Valentines day</time>.</p>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The datetime attribute does not render as anything special in any of the major browsers.


Definition and Usage

The datetime attribute gives the date or time being specified. This attribute is used if no date or time is specified in the element's content.


Differences Between HTML 4.01 and HTML5

The <time> tag is new in HTML5.


Syntax

<time datetime="YYYY-MM-DDThh:mm:ssTZD">

Attribute Values

Value Description
YYYY-MM-DDThh:mm:ssTZD The date or time being specified. Explanation of components:
  • YYYY - year (e.g. 2011)
  • MM - month (e.g. 01 for January)
  • DD - day of the month (e.g. 08)
  • T - a required separator if time is also specified
  • hh - hour (e.g. 22 for 10.00pm)
  • mm - minutes (e.g. 55)
  • ss - seconds (e.g. 03)
  • TZD - Time Zone Designator (Z denotes Zulu, also known as Greenwich Mean Time)


HTML time Tag Reference HTML <time> tag

W3Schools Certification

W3Schools' Online Certification

The perfect solution for professionals who need to balance work, family, and career building.

More than 10 000 certificates already issued!

Get Your Certificate »

The HTML Certificate documents your knowledge of HTML.

The HTML5 Certificate documents your knowledge of advanced HTML5.

The CSS Certificate documents your knowledge of advanced CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The jQuery Certificate documents your knowledge of jQuery.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]