Convert the lastModified property into a Date object:
var x = new Date(document.lastModified);
Click the button to display the date and time this document was last modified.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w. j a v a 2 s. c o m var x = new Date(document.lastModified); document.getElementById("demo").innerHTML = x; } </script> </body> </html>