title: Specify the Olson ID in a new Date()
body: <p>In <a href="https://developers.google.com/apps-script/class_calendar#createEventSeries" rel="nofollow noreferrer">Google's example for createEventSeries</a> (shown below), the Date values are specified with "EST" at the end. However, I want to specify dates for a <a href="https://stackoverflow.com/a/3269325/1168342"><em>recurring event</em> (see type #4 of the kinds of times in this answer)</a>, e.g., "every Monday at 9pm, even when DST changes." Let's say I can figure out which day is the first Monday of my recurring event. The problem is how do I specify that 9pm of that day should take into consideration whether DST is in force? </p>
  
  <p>It would be intuitive to specify a Date using a time zone name (Olson ID), e.g., using the date from the example, "July 21, 2010 09:00:00 <strong>America/Montreal</strong>". The resulting Date has a bogus value in 1969 if I try it in Google Apps Script.</p>
  
  <p>How can I specify a <code>new Date()</code> in Google Apps Script such that it groks the Olson ID I specify, e.g., "America/Montreal" as opposed to me knowing a priori if the date is actually "EST" or "EDT"?</p>
  
  <pre>// The code below will add an event to the user's default Calendar that recurs every other day 
  var cal = CalendarApp.getDefaultCalendar(); cal.createEvent("Busy", new Date("July 21, 2010 08:00:00 EST"), new Date("July 21, 2010 09:00:00 EST"), CalendarApp.newRecurrence().addDailyRule().interval(2), {location:'Nap room'});`
  </pre>
  
  <p>p.s. I found a workaround/hack that relies on <a href="http://googleappsscript.blogspot.ca/2011/03/demystifying-time-zones-in-apps-script_21.html" rel="nofollow noreferrer">the information that JavaScript new Date() in GAS will inherit the timezone of the script (see the 4th bullet point)</a>. I can set my script's timezone to that of the one I want to create my recurring events, and it appears to work. But I'd like to not rely on this detail, as it seems fragile.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here's the output of a small test using the workaround to show you how it works. Note how the <strong>GMT-0500 (EST)</strong> changes to <strong>GMT-0400 (EDT)</strong>. </p>
  
  <pre>function shortTest() {
    // DST begins on Mar 10, 2012 in "America/Montreal" (Olson ID)
    // This script's Project Properties show a Time zone (today, Dec 18, 2012) of 
    //    "(GMT-05:00) Eastern Time - Montreal"
    Logger.log("Date = " + (new Date("March 9, 2013 21:00:00")));
    Logger.log("Date = " + (new Date("March 10, 2013 21:00:00")));
    Logger.log("Date = " + (new Date("March 11, 2013 21:00:00")));
  }
  </pre>
  
  <p><strong>Logger output</strong></p>
  
  <pre>Date = Sat Mar 09 2013 21:00:00 GMT-0500 (EST)
  Date = Sun Mar 10 2013 21:00:00 GMT-0400 (EDT)
  Date = Mon Mar 11 2013 21:00:00 GMT-0400 (EDT)
  </pre>