how to get yesterday date in javascript code example

Example 1: js yesterday date

var yesterday = new Date((new Date()).valueOf() - 1000*60*60*24);

Example 2: python get timestamp of today

import datetime;
ts = datetime.datetime.now().timestamp()

Example 3: js yesterday date

var d = new Date();
d.setDate(d.getDate() - 1);

Example 4: 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);

Example 5: get today date in java 8

LocalDate localDate = LocalDate.now();