Javascript Data Type How to - Add 110 minutes to current date and time








Question

We would like to know how to add 110 minutes to current date and time.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!-- w ww  .  j  a v a 2 s .c o  m-->
    var travelling = 110 // in minutes
    var departing = new Date(2014, 6, 13, 1, 0, 0, 0);
    var arriving = new Date(departing.getTime() + travelling * 60000);
    document.writeln(arriving);
}
</script>
</head>
<body>
</body>
</html>

The code above is rendered as follows: