How to add 20 minutes to a current date?
Add it in milliseconds:
var currentDate = new Date();
var twentyMinutesLater = new Date(currentDate.getTime() + (20 * 60 * 1000));
Just add 20 minutes in milliseconds to your date:
var currentDate = new Date();
currentDate.setTime(currentDate.getTime() + 20*60*1000);
Just get the millisecond timestamp and add 20 minutes to it:
twentyMinutesLater = new Date(currentDate.getTime() + (20*60*1000))
Use .getMinutes()
to get the current minutes, then add 20 and use .setMinutes()
to update the date object.
var twentyMinutesLater = new Date();
twentyMinutesLater.setMinutes(twentyMinutesLater.getMinutes() + 20);