Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Not with the built-in <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date" rel="noreferrer"><code>Date</code> object</a>, as they're only aware of <strong><em>Local</em></strong> (as defined by the user's browser and/or OS settings) and <strong>UTC</strong>. You can see this from the many cloned methods the class has (e.g., <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getHours" rel="noreferrer"><code>getHours</code></a> / <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getUTCHours" rel="noreferrer"><code>getUTCHours</code></a>).</p> <p><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset" rel="noreferrer"><code>getTimezoneOffset</code></a> is the only timezone info you really have, but it's <em>local</em> as well and will probably only give you <code>+0</code> again (or +6 in my case):</p> <pre><code>var date = new Date("2012-01-17T12:55:00.000+01:00"); console.log(date.getTimezoneOffset() / 60.0); </code></pre> <p>You can try <a href="https://github.com/mde/timezone-js" rel="noreferrer">timezone-js</a> (or <a href="https://github.com/mde/timezone-js/network" rel="noreferrer">one of its forks</a>), but you'll need to know the <a href="http://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="noreferrer">Olson timezone name</a> not just the GMT/UTC offset:</p> <pre><code>var date = new new timezoneJS.Date('2012-01-17T12:55:00.000+01:00', 'Europe/Brussels'); alert(date.getTimezoneOffset() / 60.0); // +1 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload