title: JavaScript Date object always printed in America/New_York timezone?
body: <p>I have a time-stamp in milliseconds (<a href="http://en.wikipedia.org/wiki/Unix_time" rel="nofollow">Unix time / time from Epoch</a>) sent from my server, which uses Joda-time and always the constant timezone "<strong>America/New_York</strong>".  On my client, I also want to guarantee time is displayed according to the <strong>America/New_York</strong> timezone.  I've relied on the <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date" rel="nofollow">MDN Date documentation</a>, and have decided it's easiest to instantiate my Date objects using the new Date(<em>milliseconds</em>) constructor.  </p>
  
  <p><em><strong>Now the hard part:</em></strong>  I want to be able to print the time for clients that are using my site outside the America/New_York timezone.  I know I can <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset" rel="nofollow">getTimezoneOffset</a> from a <code>Date object</code>, so now I'm considering performing arithmetic on that object based on the offset and relying on the server to tell me if I'm in DST or not.  Using <a href="http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTimeZone.html#isStandardOffset%28long%29" rel="nofollow">this method from the Joda Time library</a>.</p>
  
  <p>I'd like a solution that works in IE8 as well as the modern browsers.  Any thoughts?  Are there any small utilities that already accomplish this in a standard way?</p>
  
  <pre><code>// dateTimeAsString is sent from the server (via JSON) as a String
  // dateTimeAsString example: "1311387300000"
  var dateTimeAsInt = parseInt(dateTimeAsString,10);
  var dateTimeInNY = new Date(dateTimeAsInt);
  
  // My current offset is 240
  var nyOffset = dateTimeInNY.getTimezoneOffset();
  
  // Somewhere out west
  var dateTimeInTexas = new Date(dateTimeAsInt);
  
  
  var isDST = false; // sent from server
  
  
  // What I want to do, this is not legal JavaScript
  dateTimeInTexas.printWithOffset(isDST,nyOffset);
  </code></pre>