JavaScript Basics

JavaScript Advanced

JavaScript Arrays

JavaScript Functions

JavaScript Objects

JavaScript DOM

JavaScript String

How to get the timezone in JavaScript?

To get the current timezone in JavaScript, call the Intl.DateTimeFormat() method. This method returns an object whose one of the properties is resolvedOptions. resolvedOptions is a method when called, returns an object.



  locale: "en-GB",
  calendar: "gregory",
  numberingSystem: "latn",
  timeZone: "Asia/Kolkata",
  year: "numeric",
  month: "2-digit",
  day: "2-digit"

After that, you need to access the timeZone property to get the timezone.

console.log(Intl.DateTimeFormat().resolvedOptions().timeZone); //"Asia/Calcutta"

There are other ways to get the timezone, but they are ineffective because they give you the timezone offset in minutes and not in UTC or GMT format.

let date = new Date();


Wed May 04 2022 09:12:00 GMT+0530 (India Standard Time)

Recommended Posts