javascript add timezone offset to date code example
Example 1: client timezone offset in JavaScript
var clientTimezoneOffset = new Date().getTimezoneOffset()/60;//offset in hours
Example 2: javascript date timezone
// this example takes 2 seconds to run
const start = Date.now();
console.log('starting timer...');
// expected output: starting timer...
setTimeout(() => {
const millis = Date.now() - start;
console.log(`seconds elapsed = ${Math.floor(millis/1000)}`);
// expected output : seconds elapsed = 2
}, 2000);