Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get timezone

var timedifference = new Date().getTimezoneOffset();
Comment

Get specific timezone time

function calcTime(city, offset) {

    d = new Date();

    utc = d.getTime() + (d.getTimezoneOffset() * 60000);

    nd = new Date(utc + (3600000*offset));

    return "The local time in " + city + " is " + nd.toLocaleString();

}

// get Bombay time
console.log(calcTime('Bombay', '+5.5'));

// get Singapore time
console.log(calcTime('Singapore', '+8'));

// get London time
console.log(calcTime('London', '+1'));
Comment

Get the Timezone

if (!sessionStorage.getItem('timezone')) {
  var tz = jstz.determine() || 'UTC';
  sessionStorage.setItem('timezone', tz.name());
}
var currTz = sessionStorage.getItem('timezone');
Comment

get timezone

var timedifference = new Date().getTimezoneOffset();
//This returns the difference from the clients timezone from UTC time. You can then play around with it as you like.
Comment

PREVIOUS NEXT
Code Example
Javascript :: Get Value of JSON As Array 
Javascript :: discordjs 
Javascript :: react component visibility 
Javascript :: javascript if one line 
Javascript :: enable javascript chrome 
Javascript :: javascript weakmap 
Javascript :: js arrow function 
Javascript :: binary search tree js 
Javascript :: base64 to base64url 
Javascript :: req is not defined 
Javascript :: array index javascript 
Javascript :: react navbar responsive 
Javascript :: javascript Program to check if a given year is leap year 
Javascript :: shopify image pciker 
Javascript :: node.js 
Javascript :: this keyword in javscript 
Javascript :: Agora Video Calls 
Javascript :: ArduinoJson.h 
Javascript :: create file object node js 
Javascript :: call javascript function from python 
Javascript :: node.js error handling 
Javascript :: javascript best online game engine 
Javascript :: what is lexical environment in javascript 
Javascript :: javascript start 
Javascript :: Check If Object Contains A Function 
Javascript :: javascript list comprehension 
Javascript :: return the sum of an array 
Javascript :: convert json data into html table 
Javascript :: how to get checked and unchecked checkbox value in jquery 
Javascript :: how to console log in react native 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =