Để thêm giây, dùng setSeconds(getSeconds() + 10). Phương thức setSeconds() thiết lập giây theo giờ địa phương.
Ví dụ
<html>
<head>
<title>Phương thức setSeconds trong JavaScript</title>
</head>
<body>
<script>
var dt = new Date("December 30, 2017 11:20:25");
dt.setSeconds(dt.getSeconds() + 10);
document.write(dt);
</script>
</body>
</html>
Kết quả
Thứ 7, 30 Thg 12 2017 11:20:35 GMT+0530