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 −

Example

 Live Demo

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

Output

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.
</ins>

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

cite="new.htm

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

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

Updated on: 30-Jul-2019

174 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements