title: Translating ActionScript Date from UTC to local time with milliseconds from epoch
body: <p>This is a follow up on my <a href="https://stackoverflow.com/questions/11632421/creating-actionscript-date-object-from-mysql-utc-timestamp-string">previous question</a>. In my solution to get current time, I need to add/subtract offset:</p>
  
  <pre><code>var createDate:Date = new Date();
  var offset:Number = createDate.getTimezoneOffset() * 60 * 1000; 
  createDate.time = parseInt("1343174921") * 1000 - offset; // subtracting offset
  </code></pre>
  
  <p>To get correct time, I had to subtract offset(pure guess).  How do I know to subtract or add offset? The documentation for <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html#timezoneOffset" rel="nofollow noreferrer">getTimezoneOffset</a> says: </p>
  
  <blockquote>
    <p>this value is the number of minutes you need to add to
    the computer's local time to equal UTC. If your computer's time is set
    later than UTC, the value will be negative.</p>
  </blockquote>
  
  <p>Is there an easy way to figure out if computer's time is set later/earlier than UTC so that I know if I need to add or subtract offset?</p>
  
  <p><strong>update</strong> I've checked the database and I'm storing an entry that was created on <code>7/25/2012 at 8pm</code> as <code>1343282417</code> (I'm using <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_utc-timestamp" rel="nofollow noreferrer">UTC_TIMESTAMP()</a> to store date). When I plug it into Unix timestamp converter I get <code>Thu, 26 Jul 2012 06:00:17 GMT</code>.  So I'm confused why does MySql's UTC_TIMESTAMP ( that suppose to return the current UTC date and time) gives me a different date. I'm working locally both the MySQL db, php and Flash code are on single machine. </p>