I have a date as string in format yyyy-mm-dd & timezone stored in another variable t in format like (GMT -05:00) Eastern Time. I want to obtain the date object with this date in this timezone in Javascript/appscript. The time in date object should be 00.00.00.000 only & timezone should as in the variable.
function dateStringsForDifferentTimezones() {
let oA = [['Date String','TimeZone']];
for (let i = 0; i < 24; i++) {
oA.push([Utilities.formatDate(new Date(), `GMT-${i}`, "E MMM dd, yyyy HH:mm:ss"),`${-i}`]);
}
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1');
sh.getRange(1, 1, oA.length, 2 ).setValues(oA);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.