JS - Add hour to date object

0 votes
81 views
added Jan 28, 2019 in Javascript by LC Marshal Captain (25,770 points)
<script>
 var dt = new Date();
 dt.setHours( dt.getHours() + 2 );
 document.write( dt );
</script>

<!--Output-->
<!--Sat Dec 15 2018 15:49:50 GMT+0530 (India Standard Time)-->

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...