del dateTime Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Del

Description

The dateTime property sets or gets the datetime attribute of a <del> text, which identifies the date and time when the text was deleted.

Set the dateTime property with the following Values

Value Description
YYYY-MM-DDThh:mm:ssTZD The date and time of when the text was deleted.
  • 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 as Greenwich Mean Time)

Return Value

A String, representing the date and time of when the text was deleted

The following code shows how to return the date and time of when some text was deleted:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p><del id="myDel" datetime="2011-11-15T22:55:03Z">This text has been deleted</del></p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*w  w  w .  j  av  a  2s.  co m*/
    var v = document.getElementById("myDel").dateTime;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials