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