Date.getTimezoneOffset()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

							date.getTimezoneOffset()

Description

The getTimezoneOffset() method returns the difference between the time zones of local time and Greenwich Mean Time (GMT). This difference is returned as an integer representing the number of minutes between the time zone of the local time and GMT. Although this is a method of a Date object, the actual date and time associated with the date is irrelevant because the time zone difference is based on the environment settings in which the JavaScript code is run.

Example

The code in Listing 6.80 displays the time zone offset by using the getTimezoneOffset() method. Notice that when the date and time ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.