1var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;var now = new Date();
2var yesterday = new Date(now.getTime() - MILLIS_PER_DAY);
1// Create a date object for the current date and time.
2var now = new Date();
3
4// Create a date object for a past date and time using a formatted string.
5var date = new Date('February 17, 2018 13:00:00 -0500');
6
7// Create a copy of an existing date object.
8var copy = new Date(date);