Javascript examples for Date:setHours
Set the time to 48 hours ago:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w . j a v a 2 s . com*/ var d = new Date(); d.setHours(d.getHours() - 48); document.getElementById("demo").innerHTML = d; } </script> </body> </html>