1let today = new Date();
2let yesterday = new Date();
3
4yesterday.setDate(today.getDate() - 1);
5
6console.log('Today: ' + today);
7console.log('Yesterday: ' + yesterday);
1var start = new Date();
2start.setHours(0, 0, 0, 0);
3start = start.getTime();
4
5var end = new Date();
6end.setHours(0, 0, 0, 0);
7end.setDate(end.getDate() + 1);
8end = end.getTime();