get timezone javascript
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timezone);
get timezone javascript
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timezone);
get user time using timezone javascript
function calcTime(city, offset) {
// create Date object for current location
var d = new Date();
// convert to msec
// subtract local time zone offset
// get UTC time in msec
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
// create new Date object for different city
// using supplied offset
var nd = new Date(utc + (3600000*offset));
// return time as a string
return "The local time for city"+ city +" is "+ nd.toLocaleString();
}
alert(calcTime('Bombay', '+5.5'));
how to see my timezone using js
document.getElementById("time").innerHTML = Date().slice(Date().indexOf("(")+1,Date().lastIndexOf(")"));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us