JS Coding Questions Logo
JS Coding Questions
#294💼 Interview💻 Code

How do you get the timezone offset of a date object

Advertisement

728x90

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
1var offset = new Date().getTimezoneOffset();
2
3console.log(offset); // -480

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 38

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
294of476