1

I have a formula setup that I want to use. But I have a separate sheet that I want to use in a different time zone. The one I have written is in EST. but I want another sheet to use the same formula but in CDT.


I am using this in Google Sheets. I am using it to have a static date and time change with a click on another cell.

function TIMESTAMP() {
var today = new Date();
var date = (today.getMonth()+1)+'/'+today.getDate()+'/'+today.getFullYear();
var Time = today.getHours(HH)+":" + today.getMinutes(mm) + ":" + today.getSeconds(ss);
var dateTime = date+' '+Time;
return dateTime;
}
1

You can use new Date(Date.UTC(year, month, day, hour, minute, sec)) to format a Date as you want it to be and delay it manually. (Ex. GMT +02, EST +.., ecc..)

Or you can use new Date().toLocaleString("en-US", {timeZone: "substitute with the timeZone you need"}) to use the TimeZone that you want. NOTICE! This doesn't work on every browser and i don't know if it works on Google Sheet. Anyway this method is suggested here: https://stackoverflow.com/a/54453990/11574313

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.