HTML datetime Attribute

The datetime attribute of the <ins> element is used to specify the date and time displaying when the text was inserted.

Following is the syntax −

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

Above, the attribute datatime displays the datetime when the text was inserted in the following format −

  • YYYY - year
  • MM - month
  • DD - day of the month
  • hh - hour
  • mm - minutes
  • ss - seconds
  • TZD - Time Zone Designator

Let us now see an example to implement the datetime attribute of the <ins> element −


 Live Demo

<!DOCTYPE html>
   <h1>Demo Heading</h1>
   <ins cite = "new.htm" datetime = "2019-05-11T18:30:03Z">Text is inserted.</ins>


In the above example, we have inserted a text using the <ins> element −

<ins cite = "new.htm" datetime = "2019-05-11T18:30:03Z">
   Text is inserted.

Above, we have set the reason of insertion using the cite attribute −


With that, we have set the date of insertion using the datetime attribute −

datetime = "2019-05-11T18:30:03Z