I want to create a Calendar event using the same timezone as the calendar.
I already have the year, month and day as numbers, in separate variables. How can I construct a Date
object using these values, in a specific timezone?
var day = 31;
var month = 11; // Month is zero-based
var year = 2014;
var timezone = calendar.getTimeZone();
// How to add the timezone here?
var date = new Date(year, month, day, 12, 0, 0);
Essentially, I ask this because of the documentation:
If no time zone is specified, the time values are interpreted in the context of the script's time zone, which may be different than the calendar's time zone.
Thus I wish to know how to correctly specify the timezone.
Relevant blog post (although it doesn't answer my question):