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