xxxxxxxxxx
const browserTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(browserTimezone);
xxxxxxxxxx
console.log(new Date().toTimeString().slice(9));
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
console.log(new Date().getTimezoneOffset() / -60);
xxxxxxxxxx
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timezone);
xxxxxxxxxx
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timezone); // Asia/Karachi
xxxxxxxxxx
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timezone);
// Africa/Casablanca
xxxxxxxxxx
console.log(Intl.DateTimeFormat().resolvedOptions())
Run code snippet
xxxxxxxxxx
fetch("https://worldtimeapi.org/api/ip")
.then(response => response.json())
.then(data => console.log(data.timezone,data.datetime,data.dst));