Getting the date of next Monday

This will retrieve the next Monday, returning the current date if already a Monday:

var d = new Date();
d.setDate(d.getDate() + (1 + 7 - d.getDay()) % 7);
console.log(d);

To return the following Monday even if the current date is a Monday:

var d = new Date();
d.setDate(d.getDate() + (((1 + 7 - d.getDay()) % 7) || 7));
console.log(d);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)