title: How to calculate the utc time and the local time from google map?
body: <p>How can I calculate the utc time and the local time from google map?</p>
  
  <p>For instance, this is the json result from google,</p>
  
  <pre><code>{
     "dstOffset" : 0.0,
     "rawOffset" : -28800.0,
     "status" : "OK",
     "timeZoneId" : "America/Los_Angeles",
     "timeZoneName" : "Pacific Standard Time"
  }
  </code></pre>
  
  <p>My function,</p>
  
  <pre><code>   function calcTime(offset) {
          var d = new Date();
          var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
          var nd = new Date(utc + (1000*offset));
  
          return nd.toLocaleString();
      }
  </code></pre>
  
  <p>Usage,</p>
  
  <pre><code>// Calculate the time.
  var local = calcTime(-28800.0);
  var utc = calcTime(0.0);
  </code></pre>
  
  <p>Am I correct?</p>