Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

javascript - Programmatically change a Google apps script's timezone

I've been having a very hard time trying to properly set up the timezones of calendar event dates because the Javascript's Date object is taking the project's timezone:

Project properties.

Is there a way to programmatically change that property?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No. The project time zone can not be changed with code. You can get the script time zone Session.getScriptTimeZone() with code, but you can not set it with code. You shouldn't be changing the script time zone in code anyway. I'm assuming that you have users who are in different time zones? If there are multiple users of the script in different time zones, then I set the Time Zone in the script to +GMT 00:00 no daylight savings. And leave it at that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...