代码示例:(标识:jsck_setutchours_3)
<!DOCTYPE html>
<html>
<body>

<p>单击按钮可显示更改为 48 小时前的日期。</p>

<button onclick="myFunction()">试一试</button>

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

<script>
function myFunction() {
  var d = new Date();
  d.setUTCHours(d.getUTCHours() - 48);
  document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>
运行结果: