Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 709 Bytes

how_do_get_the_timezone_offset_from_date.md

File metadata and controls

17 lines (11 loc) · 709 Bytes

How do you get the timezone offset from date?

You can get the timezone offset from a Date object in JavaScript using the getTimezoneOffset() method. This method returns the difference between UTC and the local time, in minutes.

Example:

const date = new Date();
const offset = date.getTimezoneOffset();
console.log(offset); // Logs the timezone offset in minutes

Tags: basic, JavaScript, Date

URL: https://www.tiktok.com/@jsmentoring/photo/7468056195111144737