How to Get the Client Timezone Offset in JavaScript

The client’s timezone offset can be detected by some JavaScript methods. Let’s discuss each of them in this tutorial.


You can get the client’s timezone offset by using the Date object’s getTimezoneOffset() method:

Javascript Date object getTimezoneOffset() method
let offset = new Date().getTimezoneOffset(); console.log(offset);


The method of toString() can be useful if you want the client timezone to be formatted:

Javascript Date object toString method
let split = new Date().toString().split(" "); let timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1].slice(0,4); console.log(timeZoneFormatted);


You can also use another method to get the system's IANA timezone in JavaScript:

Javascript Date time format method

In the ECMAScript 2015 Internationalization API version, the timeZone property will be the name of the default time zone if no timeZone property was provided in the options object provided to the Intl.DateTimeFormat constructor. in previous versions, it will return undefined.

This method is supported nearly on all browsers.

The Intl.DateTimeFormat constructor is for objects enabling language-sensitive date and time formatting.

The getTimezoneOffset() Method

The getTimezoneOffset() method represents the time difference between the UTC time and the local time, in minutes. It returns non-constant value because of the practice of using Daylight Saving Time.

The toString() Method

The toString() method returns a string representing the specified Date object. Date instances inherit their toString() method from Date.prototype. The Date.prototype.toString() returns a string representation of the Date in the format that is specified in ECMA-262.