Skip to main content
InterviewHubPRO
Section Overview
Q298

Question 298 of 536

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

56%
JavaScript & V8 Internals (536 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

How do you get the timezone offset of a date object

mid LevelCode ExamplejavascriptES6+ Modern Syntax

You can use the getTimezoneOffset method of the date object. This method returns the time zone difference, in minutes, from current locale (host system settings) to UTC

javascript
  var offset = new Date().getTimezoneOffset();
  console.log(offset); // -480