Add Months to a Date in JavaScript
const date = new Date('2021-03-25');
console.log(addMonths(2, date));
How to get GMT time in JavaScript?
function GMTTime(date = new Date()) {
return [
toDigit(date.getUTCHours()),
toDigit(date.getUTCMinutes()),
toDigit(date.getUTCSeconds()),
].join(':');
}
function toDigit(num) {
return num.toString().padStart(2, '0');
}
console.log(getGMTTime());
How to add minutes in JavaScript?
var d1 = new Date (), d2 = new Date ( d1 );
d2.setMinutes ( d1.getMinutes() + 30 );