Date().getTimezoneOffset() : getTimezoneOffset « Date « JavaScript Tutorial






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.

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.

<html>
<head>
<title>Determine Time Zone</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--

var current_date = new Date();
var current_timezone = current_date.getTimezoneOffset();

document.write("Your time zone is " + current_timezone + " minutes from GMT");

//-->
</script>
</body>
</html>








12.14.getTimezoneOffset
12.14.1.Date().getTimezoneOffset()
12.14.2.Display the timezone offsets for two different dates