Javascript examples for Date:setUTCHours
Set the time to 48 hours ago, using UTC methods:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww . j a v a2s .c o m var d = new Date(); d.setUTCHours(d.getUTCHours() - 48); document.getElementById("demo").innerHTML = d; } </script> </body> </html>