Change the value of the datetime attribute:
document.getElementById("myDel").dateTime = "2013-11-15T21:40:07Z";
Click button to change the value of the datetime attribute of the deleted text.
<!DOCTYPE html> <html> <body> <p><del id="myDel" datetime="2020-11-15T22:55:03Z">This text has been deleted</del></p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w.j a va 2s . c o m*/ document.getElementById("myDel").dateTime = "2013-11-15T21:40:07Z"; document.getElementById("demo").innerHTML = "The value of the datetime attribute was changed."; } </script> </body> </html>