Get the number of minutes that the local time zone is off set from UTC in JavaScript

Description

The following code shows how to get the number of minutes that the local time zone is off set from UTC.

Example


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var aDate = new Date(2012, 4, 5, 17, 55, 55);
document.writeln(aDate.getTimezoneOffset());
<!--from w  w w . j a  v  a  2  s.co  m-->
</script>
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Get the number of minutes that the local time zone is off set from UTC in JavaScript
Home »
  Javascript Tutorial »
    Data Type »
      Date
...
Get the UTC date's day of the week as a num...
Get the UTC date's hours as a number betwee...
Get the UTC date's milliseconds in JavaScri...
Get the UTC date's minutes as a number betw...
Get the UTC date's seconds as a number betw...
Get the date's day of the week as a number ...
Get the date's hours as a number between 0 ...
Get the date's milliseconds in JavaScript
Get the date's minutes as a number between ...
Get the date's seconds as a number between ...
Get the day of the month (1 through 31) for...
Get the day of the month (1 through 31) for...
Get the four-digit year (2007 instead of ju...
Get the four-digit year of the UTC date val...
Get the milliseconds representation of the ...
Get the month name for UTC time in JavaScri...
Get the month of the UTC date, where 0 repr...
Get the month of the date, where 0 represen...
Get the number of minutes that the local ti...
Get year, month and day from date differenc...
Parse an invalid date in JavaScript
Pass a string date value in format of "ISO ...
Parse a string date value in format of "day...
Pass a string date value in format of "mont...
Pass a string date value in format of "mont...
Pass in more value for UTC() function in Ja...
Return Date string in timezone information ...
Set the UTC date's hours with setUTCHours(h...
Set the UTC date's milliseconds with setUTC...
Set the UTC date's minutes with setUTCMinut...
Set the UTC date's seconds with setUTCSecon...
Set the date's hours with with setHours(hou...
Set the date's milliseconds with setMillise...
Set the date's minutes with setMinutes(minu...
Set the date's seconds with setSeconds(seco...
Set the day of the month for the UTC date w...
Set the day of the month for the date with ...
Set the milliseconds representation of the ...
...