“Holen Sie sich Zeitzone” Code-Antworten

Linux, wie Sie die aktuelle Zeit mit TimeZone anzeigen

timedatectl

Output
------------
                      Local time: Tue 2019-12-03 16:30:44 UTC
                  Universal time: Tue 2019-12-03 16:30:44 UTC
                        RTC time: Tue 2019-12-03 16:30:44
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
Successful Salamander

Holen Sie sich Zeitzone

var timedifference = new Date().getTimezoneOffset();
Difficult Dolphin

Holen Sie sich eine bestimmte Zeitzonezeit

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'));
Witty Wryneck

Holen Sie sich die Zeitzone

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

Holen Sie sich Zeitzone

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.
Difficult Dolphin

Ähnliche Antworten wie “Holen Sie sich Zeitzone”

Fragen ähnlich wie “Holen Sie sich Zeitzone”

Weitere verwandte Antworten zu “Holen Sie sich Zeitzone” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen