javascript get local time zone code example
Example 1: get browser timezone javascript
Intl.DateTimeFormat().resolvedOptions().timeZone
Example 2: get browser timezone
console.log(new Date().toTimeString().slice(9));
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
console.log(new Date().getTimezoneOffset() / -60);
Example 3: javascript date timezone
const start = Date.now();
console.log('starting timer...');
setTimeout(() => {
const millis = Date.now() - start;
console.log(`seconds elapsed = ${Math.floor(millis/1000)}`);
}, 2000);