Output: Thu Oct 18 2018 19:47:03 GMT+0530 (India Standard Time)
You can change the value of n. here n will be the time in minutes you want to be added with the current time.
var date1 = new Date();
here you can also pass the date and time as per your choice.
getMinutes() method returns the time in minutes ( local time )
var mytime = new Date(); var show = mytime.getMinutes(); document.write(show);
It will show you the current minute.
Now, to set the time as per our choice or to modify the time. Like if you want to subtract minutes to the current time or add some minutes to the current time you can use setMinutes() method.
setMinutes() method sets the time in minutes ( local time ) but this method can also be used to set seconds and milliseconds too.
var mytime = new Date(); var show = mytime.setMinutes(48); document.write(show);
It will show you the time but the minute will be set to 48 minutes.
i.e, if the time is 19:45:23 it will show you 19:48:23
If you have any doubts feel free to comment below.