Answers for "javascript create date for today but is returning yesterday"

1

js date of yesterday

let today = new Date();
let yesterday = new Date();

yesterday.setDate(today.getDate() - 1);

console.log('Today: ' + today);
console.log('Yesterday: ' + yesterday);
Posted by: Guest on December-04-2020
0

javascript beginning of today and yesterday

var start = new Date();
start.setHours(0, 0, 0, 0);
start = start.getTime();

var end = new Date();
end.setHours(0, 0, 0, 0);
end.setDate(end.getDate() + 1);
end = end.getTime();
Posted by: Guest on February-14-2021

Code answers related to "javascript create date for today but is returning yesterday"

Code answers related to "Javascript"

Browse Popular Code Answers by Language