Answers for "javascript new date showing previous day"

0

set a previous year to the current date in javascript

const d = new Date();
d.setFullYear(d.getFullYear()-1);

console.log(d.toDateString()); // "Fri Oct 04 2019"
Posted by: Guest on August-29-2021
0

get previous week date in javascript

function nextweek(){
    var today = new Date();
    var nextweek = new Date(today.getFullYear(), today.getMonth(), today.getDate()+7);
    return nextweek;
}
Posted by: Guest on March-08-2020

Code answers related to "javascript new date showing previous day"

Code answers related to "Javascript"

Browse Popular Code Answers by Language