Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
SyntaxdateObj.getTimezoneOffset()
Return Value
Returns the number of minutes between the time on the current computer (either the client machine or, if this method is called from a server script, the server machine) and UTC. It is positive if the current computer’s local time is behind UTC (e.g., Pacific Daylight Time), and negative if the current computer’s local time is ahead of UTC (e.g., Japan). If a server in New York City is contacted by a client in Los Angeles on December 1, getTimezoneOffset returns 480 if executed on the client, or 300 if executed on the server.
ExamplesThe following example shows how to use the getTimezoneOffset method.
var date = new Date();
var minutes = date.getTimezoneOffset();
if (minutes < 0)
document.write(minutes / 60 + " hours after UTC");
else
document.write(minutes / 60 + " hours before UTC");
7 hours before UTC
Remarks
The required dateObj reference is a Date object.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4