getTimezoneOffset()  Date  instance method getterS2C Home  « Globals « Date « getTimezoneOffset()

Description

Returns the locale specific time zone offset from UTC in minutes.

  • Times behind UTC will return a positive value.
  • Times ahead UTC will return a negative value.

Syntax

Signature Description
aDate.getTimezoneOffset()Returns the locale specific second of the minute (0-59) for the specified date.

Parameters

None.

Examples

The code below shows an example of the getTimezoneOffset() method of Date.


// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);

// Get timezone offset for locale compared to UTC.
alert(todaysDate.getTimezoneOffset() + ' = your timezone offset in minutes');

Press the button below to action the above code:


Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times

go to home page Homepage go to top of page Top