Open In App
Related Articles

HTML | datetime Attribute

Improve Article
Save Article
Like Article

The HTML datetime Attribute is used to specify the date and time of the inserted and the deleted text. It also represents the date and time of the <time> element. 

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

Attribute Values: This attribute contains single value YYYY-MM-DDThh:mm:ssTZD which is used to specify the date and time when the text was deleted.

The explanation of datetime components are listed below:

  • YYYY: It sets the year of datetime object (e.g. 2009).
  • MM: It sets the month of datetime object (e.g. 05 for March).
  • DD: It sets the day of the month of datetime object (e.g. 04).
  • T: It is a required separator.
  • hh: It sets the hour of datetime object (e.g. 18 for 06.00pm).
  • mm: It sets the minutes of datetime object (e.g. 34).
  • ss: It sets the seconds of date
  • time object (e.g. 40).

ZD: Time Zone Designator (Z denotes Zulu, also known as Greenwich Mean Time)

Applicable: datetime attribute is applicable for: 

Example: This Example illustrates the use of datetime attribute. 


<!DOCTYPE html>
        HTML datetime Attribute
        del {
            color: red;
        ins {
            color: green;
        h1 {
            color: green;
        body {
            text-align: center;
        HTML datetime Attribute
<p>GeeksforGeeks is a
        <!-- Assigning id to
            'ins' tag -->
        <ins id="GFG" datetime="2018-11-21T15:55:03Z">
        <time datetime="2017-02-14 20:00">


Supported Browsers: The browsers supported by datetime Attribute are listed below: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 15 Jul, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials