Node.jsでDateコンストラクを使ってdateオブジェクトを生成するときに任意のタイムゾーンを設定できない。
つまり、Dateコンストラクを使ってdateオブジェクトを生成する環境によって日時が異なることを意味する。
そこで今回、どんな環境で実行しても任意で設定したタイムゾーンの現地時間を表示するLocalTimeモジュールを作る。
LocalTimeモジュールをLocalTime.jsとする。
const LocalTime = (function() {
const that = {};
const my = {};
const WeekChars = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
my.TimeZone = "";
my.lang = "EN";
my.LocalTime = new Map();
my.TodayDate = new Map();
my.YesterdayDate = new Map();
my.TomorrowDate = new Map();
my.LocalTimeString = "";
my.UTCTimeString = "";
my.Today_Day = "";
my.Tomorrow_Day = "";
my.Yesterday_Day = "";
//TimeZoneに設定可能な都市
my.city = new Map();
my.city.set("LON", [0, "UTC + 0", "No.01", "イギリス \/ ロンドン", "The United Kingdom \/ London"]);
my.city.set("MAD", [1, "UTC + 1", "No.02", "スペイン \/ マドリード", "Spain \/ Madrid"]);
my.city.set("PAR", [1, "UTC + 1", "No.03", "フランス \/ パリ", "France \/ Paris"]);
my.city.set("ROM", [1, "UTC + 1", "No.04", "イタリア \/ ローマ", "Italy \/ Rome"]);
my.city.set("BER", [1, "UTC + 1", "No.05", "ドイツ \/ ベルリン", "Germany \/ Berlin"]);
my.city.set("CAI", [2, "UTC + 2", "No.06", "エジプト \/ カイロ", "Egypt \/ Cairo"]);
my.city.set("AHI", [2, "UTC + 2", "No.07", "ギリシャ \/ アテネ", "Greece \/ Athens"]);
my.city.set("JNB", [2, "UTC + 2", "No.08", "南アフリカ共和国 \/ ヨハネスブルグ", "South Africa \/ Johannesburg"]);
my.city.set("RUH", [3, "UTC + 3", "No.09", "サウジアラビア \/ リヤド", "Saudi Arabia \/ Riyadh"]);
my.city.set("THR", [3.5, "UTC + 3.5", "No.10", "イラン \/ テヘラン", "Iran \/ Tehran"]);
my.city.set("DXB", [4, "UTC + 4", "No.11", "アラブ首長国連邦 \/ ドバイ", "United Arab Emirates \/ Dubai"]);
my.city.set("KBL", [4.5, "UTC + 4.5", "No.12", "アフガニスタン \/ カブール", "Afghanistan \/ Kabul"]);
my.city.set("KHI", [5, "UTC + 5", "No.13", "パキスタン \/ カラチ", "Pakistan \/ Karachi"]);
my.city.set("DEL", [5.5, "UTC + 5.5", "No.14", "インド / デリー", "India/Delhi"]);
my.city.set("DAC", [6, "UTC + 6", "No.15", "バングラデシュ \/ ダッカ", "Bangladesh \/ Dhaka"]);
my.city.set("RGN", [6.5, "UTC + 6.5", "No.16", "ミャンマー \/ ヤンゴン", "Myanmar \/ Yangon"]);
my.city.set("BKK", [7, "UTC + 7", "No.17", "タイ \/ バンコク", "Bangkok, Thailand"]);
my.city.set("SIN", [8, "UTC + 8", "No.18", "シンガポール \/ シンガポール", "Singapore \/ Singapore"]);
my.city.set("HKG", [8, "UTC + 8", "No.19", "香港特別行政区 \/ 香港", "Hong Kong \/ Hong Kong"]);
my.city.set("BJS", [8, "UTC + 8", "No.20", "中華人民共和国 \/ 北京", "China \/ Beijing"]);
my.city.set("TPE", [8, "UTC + 8", "No.21", "台湾地区 \/ 台北", "Taiwan \/ Taipei"]);
my.city.set("TYO", [9, "UTC + 9", "No.22", "日本 \/ 東京", "Japan \/ Tokyo"]);
my.city.set("SEL", [9, "UTC + 9", "No.23", "韓国 \/ ソウル", "South Korea \/ Seoul"]);
my.city.set("ADL", [9.5, "UTC + 9.5", "No.24", "オーストラリア \/ アデレード", "Australia \/ Adelaide"]);
my.city.set("SYD", [10, "UTC + 10", "No.25", "オーストラリア \/ シドニー", "Australia \/ Sydney"]);
my.city.set("NOU", [11, "UTC + 11", "No.26", "ニューカレドニア \/ ヌーメア", "New Caledonia \/ Noumea"]);
my.city.set("AKL", [12, "UTC + 12", "No.27", "ニュージーランド \/ オークランド", "New Zealand \/ Auckland"]);
my.city.set("SUV", [12, "UTC + 12", "No.28", "フィジー諸島共和国 \/ スバ", "The Republic of Fiji \/ sSuva"]);
my.city.set("MDY", [-11, "UTC - 11", "No.29", "アメリカ合衆国 \/ ミッドウェー諸島", "The United States of America \/ Midway Atoll"]);
my.city.set("HNL", [-10, "UTC - 10", "No.30", "アメリカ合衆国 \/ ホノルル", "The United States of America \/ Honolulu"]);
my.city.set("ANC", [-9, "UTC - 9", "No.31", "アメリカ合衆国 \/ アンカレジ", "The United States of America \/ Anchorage"]);
my.city.set("YVR", [-8, "UTC - 8", "No.32", "カナダ \/ バンクーバー", "Canada \/ Vancouver"]);
my.city.set("LAX", [-8, "UTC - 8", "No.33", "アメリカ合衆国 \/ ロサンゼルス", "The United States of America \/ Los Angeles"]);
my.city.set("DEN", [-7, "UTC - 7", "No.34", "アメリカ合衆国 \/ デンバー", "The United States of America \/ Denver"]);
my.city.set("MEX", [-6, "UTC - 6", "No.35", "メキシコ \/ メキシコシティー", "Mexico \/ Mexico City"]);
my.city.set("CHI", [-6, "UTC - 6", "No.36", "アメリカ合衆国 \/ シカゴ", "The United States of America \/ Chicago"]);
my.city.set("NYC", [-5, "UTC - 5", "No.37", "アメリカ合衆国 \/ ニューヨーク", "The United States of America \/ New York"]);
my.city.set("YMQ", [-5, "UTC - 5", "No.38", "カナダ \/ モントリオール", "Canada \/ Montreal"]);
my.city.set("MAO", [-4, "UTC - 4", "No.39", "ブラジル \/ マナウス", "Brazil \/ Manaus"]);
my.city.set("BUE", [-3, "UTC - 3", "No.40", "アルゼンチン \/ ブエノスアイレス", "Argentina \/ Buenos Aires"]);
my.city.set("RIO", [-3, "UTC - 3", "No.41", "ブラジル \/ リオデジャネイロ", "Brazil \/ Rio de Janeiro"]);
my.city.set("FEN", [-2, "UTC - 2", "No.42", "ブラジル \/ フェルナンド・デ・ノローニャ諸島", "Brazil \/ Fernando de Noronha"]);
my.city.set("PDL", [-1, "UTC - 1", "No.43", "ポルトガル領 \/ アゾレス諸島", "Portuguese \/ Azores"]);
//時差の計算をする
my.Calculate = function() {
const GetTimeString = function(TimeZone, map) {
const TMPTime = [];
TMPTime.push("[");
TMPTime.push(TimeZone);
TMPTime.push("] ");
TMPTime.push(map.get("yyyy"));
TMPTime.push("-");
TMPTime.push(map.get("MM"));
TMPTime.push("-");
TMPTime.push(map.get("dd"));
TMPTime.push("(");
TMPTime.push(map.get("day"));
TMPTime.push(")");
TMPTime.push(" ");
TMPTime.push(map.get("hh"));
TMPTime.push(":");
TMPTime.push(map.get("mm"));
TMPTime.push(":");
TMPTime.push(map.get("ss"));
TMPTime.push(".");
TMPTime.push(map.get("msec"));
return TMPTime.join("");
};
const SplitUTC = function(t, day) {
let map = new Map();
//toISOString()メソッドで現在時刻をISO 8601形式のUTC表現にした値を引数tとする
//tの例2023-04-15T03:35:45.794
//「年」、「月」、「日」、「時」、「分」、「秒」、「ミリ秒」に分解してmapに格納する。
//年
let yyyy = t.split("T")[0].split("-")[0];
map.set(day + "yyyy", yyyy);
//月
let MM = t.split("T")[0].split("-")[1];
map.set(day + "MM", MM);
//日
let dd = t.split("T")[0].split("-")[2];
map.set(day + "dd", dd);
//時
let hh = t.split("T")[1].split("-")[0].split(":")[0];
map.set(day + "hh", hh);
//分
let mm = t.split("T")[1].split("-")[0].split(":")[1];
map.set(day + "mm", mm);
//秒
let ss = t.split("T")[1].split("-")[0].split(":")[2].split(".")[0];
map.set(day + "ss", ss);
//ミリ秒
let msec = t.split("T")[1].split("-")[0].split(":")[2].split(".")[1].split("Z")[0];
map.set(day + "msec", msec);
return map;
}; //splitUTCの終わり
const CalLocalTime = function(map, TimeZone) {
let city = this.city.get(TimeZone);
let a = parseInt(this.TodayDate.get("Today_hh"), 10) * 60 + parseInt(this.TodayDate.get("Today_mm"), 10);
if (city[0] > 0) {
let a2 = a + city[0] * 60;
let a3 = a2 % 60;
let a4 = Math.floor(a2 / 60);
a3 = ("0" + a3).slice(-2);
map.set("mm", a3);
if (a4 >= 24) {
//明日の日付になる。
let a5 = a4 - 24;
a5 = ("0" + a5).slice(-2);
map.set("yyyy", this.TomorrowDate.get("Tomorrow_yyyy"));
map.set("MM", this.TomorrowDate.get("Tomorrow_MM"));
map.set("dd", this.TomorrowDate.get("Tomorrow_dd"));
map.set("hh", a5);
map.set("day", WeekChars[this.Tomorrow_Day]);
} else {
a4 = ("0" + a4).slice(-2);
map.set("hh", a4);
}
}
if (city[0] < 0) {
let a2 = 0;
if (a + city[0] * 60 >= 0) {
a2 = a + city[0] * 60;
} else {
//昨日の日付になる。
a2 = a + 24 * 60 + city[0] * 60;
map.set("yyyy", this.YesterdayDate.get("Yesterday_yyyy"));
map.set("MM", this.YesterdayDate.get("Yesterday_MM"));
map.set("dd", this.YesterdayDate.get("Yesterday_dd"));
map.set("day", WeekChars[this.Yesterday_Day]);
}
let a3 = Math.floor(a2 / 60);
let a4 = a2 % 60;
a3 = ("0" + a3).slice(-2);
map.set("hh", a3);
a4 = ("0" + a4).slice(-2);
map.set("mm", a4);
}
}; //CalLocalTimeの終わり
const date = new Date();
//今日の現在時刻(ISO形式)
let today = date.toISOString();
//LocalTimeを一時的に格納する
let map = new Map();
//今日の曜日
this.Today_Day = date.getUTCDay();
//昨日の曜日
this.Yesterday_Day = (this.Today_Day) === 0 ? 6 : (this.Today_Day - 1);
//明日の曜日
this.Tomorrow_Day = (this.Today_Day) === 6 ? 0 : (this.Today_Day + 1);
//今日の現在時刻(ISO形式)
this.TodayDate = SplitUTC(today, "Today_");
map.set("yyyy", this.TodayDate.get("Today_yyyy"));
map.set("MM", this.TodayDate.get("Today_MM"));
map.set("dd", this.TodayDate.get("Today_dd"));
map.set("day", WeekChars[this.Today_Day]);
map.set("hh", this.TodayDate.get("Today_hh"));
map.set("mm", this.TodayDate.get("Today_mm"));
map.set("ss", this.TodayDate.get("Today_ss"));
map.set("msec", this.TodayDate.get("Today_msec"));
//my.UTCTimeStringを設定する
this.UTCTimeString = GetTimeString("UTC", map);
//昨日の現在時刻(ISO形式)
let yesterday = (new Date((new Date(today)).getTime() - (24 * 60 * 60 * 1000))).toISOString();
this.YesterdayDate = SplitUTC(yesterday, "Yesterday_");
//明日の現在時刻(ISO形式)
let tomorrow = (new Date((new Date(today)).getTime() + (24 * 60 * 60 * 1000))).toISOString();
this.TomorrowDate = SplitUTC(tomorrow, "Tomorrow_");
//LocalTimeを計算する。
CalLocalTime.call(my, map, this.TimeZone);
//my.LocalTimeStringを設定する
this.LocalTimeString = GetTimeString(this.TimeZone, map);
//that.get("〇〇")で取得する値を設定する。
this.LocalTime.set("TimeZone", this.TimeZone);
this.LocalTime.set("SerialNumber", my.city.get(this.TimeZone)[2]);
this.LocalTime.set("TimeDifference", my.city.get(this.TimeZone)[1]);
if (my.lang === "JP") {
//都市名が日本語
this.LocalTime.set("City", my.city.get(this.TimeZone)[3]);
} else {
//都市名が英語
this.LocalTime.set("City", my.city.get(this.TimeZone)[4]);
}
this.LocalTime.set("FullYear", map.get("yyyy"));
this.LocalTime.set("Month", map.get("MM"));
this.LocalTime.set("Date", map.get("dd"));
this.LocalTime.set("Day", map.get("day"));
this.LocalTime.set("Hours", map.get("hh"));
this.LocalTime.set("Minutes", map.get("mm"));
this.LocalTime.set("Seconds", map.get("ss"));
this.LocalTime.set("Milliseconds", map.get("msec"));
}; //my.Calculateの終わり
that.GetLocalTimeString = function() {
let ret = (my.lang === "JP") ? "ERROR:TimeZoneが設定されていません。" : "ERROR:TimeZone is not set.";
//時差の計算をする
my.Calculate();
//my.TimeZoneに空文字以外の値が設定されていること。
//my.LocalTimeStringを返す。
if (my.TimeZone !== "") {
ret = my.LocalTimeString;
}
return ret;
};
that.GetUTCTimeString = function() {
let ret = (my.lang === "JP") ? "ERROR:TimeZoneが設定されていません。" : "ERROR:TimeZone is not set.";
//時差の計算をする
my.Calculate();
//my.TimeZoneに空文字以外の値が設定されていること。
//my.UTCTimeStringを返す。
if (my.TimeZone !== "") {
ret = my.UTCTimeString;
}
return ret;
};
//設定可能な都市
that.GetAvailableCities = function() {
const str = [];
const whitespace = 1;
const result = [];
const names = [];
let stringLengthMax = 0;
let buf = " ";
let blanks = "";
my.city.forEach(function(value, key, i) {
names.push(key + " (" + value[1] + ")");
if (my.lang === "JP") {
result.push(value[2] + " " + value[3]);
} else {
result.push(value[2] + " " + value[4]);
}
});
//names配列の中の文字列で最大長をstringLengthMaxに格納する。
names.forEach(t => {
if (t.length > stringLengthMax) stringLengthMax = t.length;
});
//bufに格納した文字列を「stringLengthMax + whitespace」回数分のコピーを含む新しい文字列を作る。
blanks = buf.repeat(stringLengthMax + whitespace);
str.push("--AvailableCities(" + my.city.size + ") begin--\n");
names.forEach((t, u) => (str.push(t + ":" + blanks.slice(t.length) + result[u] + "\n")));
str.push("--AvailableCities(" + my.city.size + ") end--");
return str.join("");
};
that.Get = function(str) {
str = str.trim();
//LocalTimeの「タイムゾーン」、「時差」、「年」、「月」、「日」、「時」、「分」、「秒」、「ミリ秒」を取得する。
let ret = (my.lang === "JP") ? "ERROR:TimeZoneが設定されていません。" : "ERROR:TimeZone is not set.";
//strはmy.TimeZoneが空文字ではないこと、かつmap形式のLocalTimeが持つ値と同じ値であること
if (my.TimeZone !== "") {
if (my.LocalTime.has(str)) {
ret = my.LocalTime.get(str);
} else {
ret = (my.lang === "JP") ? "ERROR:'" + str + "'はLocalTimeに存在しないメソッド名です。" : "ERROR:'" + str + "' is a method name that does not exist in LocalTime.";
}
}
return ret;
};
that.SetLang = function(str) {
str = str.trim();
if (str === "JP") {
my.lang = "JP";
} else if (str === "EN") {
console.log("ERROR:'EN' is invalid. Default language is English.");
} else {
console.log("ERROR:'" + str + "' is invalid. Languages are Japanese and English only.");
}
};
that.SetTimeZone = function(str) {
str = str.trim();
//strが空文字ではないこと、かつmap形式のcityが持つ値と同じであること。
if (str !== "" && my.city.has(str)) {
my.TimeZone = str;
//時差の計算をする
my.Calculate();
} else {
const msg = (my.lang === "JP") ? "ERROR:TimeZoneの文字列が間違っています。" : "ERROR:The TimeZone string is incorrect.";
console.log(msg);
}
};
return that;
})();
module.exports = LocalTime;
タイムゾーンは、43種類の都市名から選択する。
仕組みとして、どんな環境で実行してもUTC(協定世界時)は同じ値になるため、UTCの値から時差を計算することによって設定した都市名の現地時間を求めている。
★使い方
自作モジュールLocalTime.jsをrequireを使ってインポートして、定数localTimeに格納する。
localTimeオブジェクトから次のメソッドを実行する。
SetLangメソッド:日本語にしたいときは「JP」を設定する。設定しない場合は英語になる。
SetTimeZoneメソッド:「TimeZoneの都市名アルファベット3文字」を設定する。 例 LON
GetAvailableCitiesメソッド:設定可能な都市名一覧を表示される。
GetUTCTimeStringメソッド:「UTC時間」を表示される。
表示例 [UTC] 2023-05-22(Mon) 06:17:54.152
GetLocalTimeStringメソッド:「現地時間」を表示される。
表示例 [LON] 2023-05-22(Mon) 06:17:54.152
TimeZoneメソッド:「TimeZoneの都市名アルファベット3文字」を取得する。 例 LON
SerialNumberメソッド:「都市名の番号」を取得する。例 No.01
TimeDifferenceメソッド:「UTCと現地時間の差」を取得する。例 UTC + 0
Cityメソッド:「国名 / 都市名」を表示する。例 イギリス / ロンドン
FullYearメソッド:「年」を取得する。
Monthメソッド:「月」を取得する。
Dateメソッド:「日」を取得する。
Dayメソッド:「曜日」を取得する。
Hoursメソッド:「時間」を取得する。
Minutesメソッド:「分」を取得する。
Secondsメソッド:「秒」を取得する。
Millisecondsメソッド:「ミリ秒」を取得する。
次のコードをtest.jsとする。
const localTime = require("./LocalTime.js");
const whitespace = 2;
const result = [];
const names = [];
let stringLengthMax = 0;
let buf = " ";
let blanks = "";
names[0] = "TimeZone";
names[1] = "SerialNumber";
names[2] = "TimeDifference";
names[3] = "City";
names[4] = "FullYear";
names[5] = "Month";
names[6] = "Date";
names[7] = "Day";
names[8] = "Hours";
names[9] = "Minutes";
names[10] = "Seconds";
names[11] = "Milliseconds";
const test = function(TimeZone) {
localTime.SetTimeZone(TimeZone);
result[0] = localTime.Get("TimeZone")
result[1] = localTime.Get("SerialNumber");
result[2] = localTime.Get("TimeDifference");
result[3] = localTime.Get("City");
result[4] = localTime.Get("FullYear");
result[5] = localTime.Get("Month");
result[6] = localTime.Get("Date");
result[7] = localTime.Get("Day");
result[8] = localTime.Get("Hours");
result[9] = localTime.Get("Minutes");
result[10] = localTime.Get("Seconds");
result[11] = localTime.Get("Milliseconds");
//names配列の中の文字列で最大長をstringLengthMaxに格納する。
names.forEach(t => {
if (t.length > stringLengthMax) stringLengthMax = t.length;
});
//bufに格納した文字列を「stringLengthMax + whitespace」回数分のコピーを含む新しい文字列を作る。
blanks = buf.repeat(stringLengthMax + whitespace);
console.log(localTime.GetUTCTimeString());
console.log(localTime.GetLocalTimeString());
//現地時間の「タイムゾーン」、「年」、「月」、「日」、「時」、「分」、「秒」、「ミリ秒」を表示させる。
names.forEach((t, u) => (console.log(t + ":" + blanks.slice(t.length) + result[u])));
}
localTime.SetLang("JP");
test("LON");
test("MAD");
test("PAR");
test("ROM");
test("BER");
test("CAI");
test("AHI");
test("JNB");
test("RUH");
test("THR");
test("DXB");
test("KBL");
test("KHI");
test("DEL");
test("DAC");
test("RGN");
test("BKK");
test("SIN");
test("HKG");
test("BJS");
test("TPE");
test("TYO");
test("SEL");
test("ADL");
test("SYD");
test("NOU");
test("AKL");
test("SUV");
test("MDY");
test("HNL");
test("ANC");
test("YVR");
test("LAX");
test("DEN");
test("MEX");
test("CHI");
test("NYC");
test("YMQ");
test("MAO");
test("BUE");
test("RIO");
test("FEN");
test("PDL");
//設定可能な都市名の一覧を出す。
console.log(localTime.GetAvailableCities());
実行すると、次のようになる。
c:\node\test>node test.js
[UTC] 2023-05-28(Sun) 11:46:36.507
[LON] 2023-05-28(Sun) 11:46:36.513
TimeZone: LON
SerialNumber: No.01
TimeDifference: UTC + 0
City: イギリス / ロンドン
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 11
Minutes: 46
Seconds: 36
Milliseconds: 506
[UTC] 2023-05-28(Sun) 11:46:36.515
[MAD] 2023-05-28(Sun) 12:46:36.516
TimeZone: MAD
SerialNumber: No.02
TimeDifference: UTC + 1
City: スペイン / マドリード
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 12
Minutes: 46
Seconds: 36
Milliseconds: 515
[UTC] 2023-05-28(Sun) 11:46:36.526
[PAR] 2023-05-28(Sun) 12:46:36.527
TimeZone: PAR
SerialNumber: No.03
TimeDifference: UTC + 1
City: フランス / パリ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 12
Minutes: 46
Seconds: 36
Milliseconds: 525
[UTC] 2023-05-28(Sun) 11:46:36.550
[ROM] 2023-05-28(Sun) 12:46:36.551
TimeZone: ROM
SerialNumber: No.04
TimeDifference: UTC + 1
City: イタリア / ローマ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 12
Minutes: 46
Seconds: 36
Milliseconds: 549
[UTC] 2023-05-28(Sun) 11:46:36.575
[BER] 2023-05-28(Sun) 12:46:36.576
TimeZone: BER
SerialNumber: No.05
TimeDifference: UTC + 1
City: ドイツ / ベルリン
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 12
Minutes: 46
Seconds: 36
Milliseconds: 575
[UTC] 2023-05-28(Sun) 11:46:36.598
[CAI] 2023-05-28(Sun) 13:46:36.602
TimeZone: CAI
SerialNumber: No.06
TimeDifference: UTC + 2
City: エジプト / カイロ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 13
Minutes: 46
Seconds: 36
Milliseconds: 598
[UTC] 2023-05-28(Sun) 11:46:36.623
[AHI] 2023-05-28(Sun) 13:46:36.625
TimeZone: AHI
SerialNumber: No.07
TimeDifference: UTC + 2
City: ギリシャ / アテネ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 13
Minutes: 46
Seconds: 36
Milliseconds: 623
[UTC] 2023-05-28(Sun) 11:46:36.648
[JNB] 2023-05-28(Sun) 13:46:36.650
TimeZone: JNB
SerialNumber: No.08
TimeDifference: UTC + 2
City: 南アフリカ共和国 / ヨハネスブルグ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 13
Minutes: 46
Seconds: 36
Milliseconds: 648
[UTC] 2023-05-28(Sun) 11:46:36.672
[RUH] 2023-05-28(Sun) 14:46:36.673
TimeZone: RUH
SerialNumber: No.09
TimeDifference: UTC + 3
City: サウジアラビア / リヤド
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 14
Minutes: 46
Seconds: 36
Milliseconds: 672
[UTC] 2023-05-28(Sun) 11:46:36.695
[THR] 2023-05-28(Sun) 15:16:36.696
TimeZone: THR
SerialNumber: No.10
TimeDifference: UTC + 3.5
City: イラン / テヘラン
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 15
Minutes: 16
Seconds: 36
Milliseconds: 695
[UTC] 2023-05-28(Sun) 11:46:36.719
[DXB] 2023-05-28(Sun) 15:46:36.720
TimeZone: DXB
SerialNumber: No.11
TimeDifference: UTC + 4
City: アラブ首長国連邦 / ドバイ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 15
Minutes: 46
Seconds: 36
Milliseconds: 719
[UTC] 2023-05-28(Sun) 11:46:36.743
[KBL] 2023-05-28(Sun) 16:16:36.745
TimeZone: KBL
SerialNumber: No.12
TimeDifference: UTC + 4.5
City: アフガニスタン / カブール
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 16
Minutes: 16
Seconds: 36
Milliseconds: 743
[UTC] 2023-05-28(Sun) 11:46:36.770
[KHI] 2023-05-28(Sun) 16:46:36.771
TimeZone: KHI
SerialNumber: No.13
TimeDifference: UTC + 5
City: パキスタン / カラチ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 16
Minutes: 46
Seconds: 36
Milliseconds: 769
[UTC] 2023-05-28(Sun) 11:46:36.794
[DEL] 2023-05-28(Sun) 17:16:36.795
TimeZone: DEL
SerialNumber: No.14
TimeDifference: UTC + 5.5
City: インド / デリー
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 17
Minutes: 16
Seconds: 36
Milliseconds: 793
[UTC] 2023-05-28(Sun) 11:46:36.817
[DAC] 2023-05-28(Sun) 17:46:36.819
TimeZone: DAC
SerialNumber: No.15
TimeDifference: UTC + 6
City: バングラデシュ / ダッカ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 17
Minutes: 46
Seconds: 36
Milliseconds: 817
[UTC] 2023-05-28(Sun) 11:46:36.843
[RGN] 2023-05-28(Sun) 18:16:36.845
TimeZone: RGN
SerialNumber: No.16
TimeDifference: UTC + 6.5
City: ミャンマー / ヤンゴン
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 18
Minutes: 16
Seconds: 36
Milliseconds: 843
[UTC] 2023-05-28(Sun) 11:46:36.872
[BKK] 2023-05-28(Sun) 18:46:36.874
TimeZone: BKK
SerialNumber: No.17
TimeDifference: UTC + 7
City: タイ / バンコク
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 18
Minutes: 46
Seconds: 36
Milliseconds: 872
[UTC] 2023-05-28(Sun) 11:46:36.904
[SIN] 2023-05-28(Sun) 19:46:36.906
TimeZone: SIN
SerialNumber: No.18
TimeDifference: UTC + 8
City: シンガポール / シンガポール
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 19
Minutes: 46
Seconds: 36
Milliseconds: 904
[UTC] 2023-05-28(Sun) 11:46:36.928
[HKG] 2023-05-28(Sun) 19:46:36.930
TimeZone: HKG
SerialNumber: No.19
TimeDifference: UTC + 8
City: 香港特別行政区 / 香港
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 19
Minutes: 46
Seconds: 36
Milliseconds: 927
[UTC] 2023-05-28(Sun) 11:46:36.953
[BJS] 2023-05-28(Sun) 19:46:36.955
TimeZone: BJS
SerialNumber: No.20
TimeDifference: UTC + 8
City: 中華人民共和国 / 北京
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 19
Minutes: 46
Seconds: 36
Milliseconds: 953
[UTC] 2023-05-28(Sun) 11:46:36.977
[TPE] 2023-05-28(Sun) 19:46:36.979
TimeZone: TPE
SerialNumber: No.21
TimeDifference: UTC + 8
City: 台湾地区 / 台北
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 19
Minutes: 46
Seconds: 36
Milliseconds: 976
[UTC] 2023-05-28(Sun) 11:46:37.003
[TYO] 2023-05-28(Sun) 20:46:37.004
TimeZone: TYO
SerialNumber: No.22
TimeDifference: UTC + 9
City: 日本 / 東京
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 20
Minutes: 46
Seconds: 37
Milliseconds: 002
[UTC] 2023-05-28(Sun) 11:46:37.027
[SEL] 2023-05-28(Sun) 20:46:37.029
TimeZone: SEL
SerialNumber: No.23
TimeDifference: UTC + 9
City: 韓国 / ソウル
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 20
Minutes: 46
Seconds: 37
Milliseconds: 027
[UTC] 2023-05-28(Sun) 11:46:37.051
[ADL] 2023-05-28(Sun) 21:16:37.052
TimeZone: ADL
SerialNumber: No.24
TimeDifference: UTC + 9.5
City: オーストラリア / アデレード
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 21
Minutes: 16
Seconds: 37
Milliseconds: 051
[UTC] 2023-05-28(Sun) 11:46:37.075
[SYD] 2023-05-28(Sun) 21:46:37.077
TimeZone: SYD
SerialNumber: No.25
TimeDifference: UTC + 10
City: オーストラリア / シドニー
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 21
Minutes: 46
Seconds: 37
Milliseconds: 075
[UTC] 2023-05-28(Sun) 11:46:37.102
[NOU] 2023-05-28(Sun) 22:46:37.104
TimeZone: NOU
SerialNumber: No.26
TimeDifference: UTC + 11
City: ニューカレドニア / ヌーメア
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 22
Minutes: 46
Seconds: 37
Milliseconds: 100
[UTC] 2023-05-28(Sun) 11:46:37.126
[AKL] 2023-05-28(Sun) 23:46:37.128
TimeZone: AKL
SerialNumber: No.27
TimeDifference: UTC + 12
City: ニュージーランド / オークランド
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 23
Minutes: 46
Seconds: 37
Milliseconds: 126
[UTC] 2023-05-28(Sun) 11:46:37.154
[SUV] 2023-05-28(Sun) 23:46:37.155
TimeZone: SUV
SerialNumber: No.28
TimeDifference: UTC + 12
City: フィジー諸島共和国 / スバ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 23
Minutes: 46
Seconds: 37
Milliseconds: 153
[UTC] 2023-05-28(Sun) 11:46:37.177
[MDY] 2023-05-28(Sun) 00:46:37.179
TimeZone: MDY
SerialNumber: No.29
TimeDifference: UTC - 11
City: アメリカ合衆国 / ミッドウェー諸島
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 00
Minutes: 46
Seconds: 37
Milliseconds: 177
[UTC] 2023-05-28(Sun) 11:46:37.206
[HNL] 2023-05-28(Sun) 01:46:37.207
TimeZone: HNL
SerialNumber: No.30
TimeDifference: UTC - 10
City: アメリカ合衆国 / ホノルル
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 01
Minutes: 46
Seconds: 37
Milliseconds: 206
[UTC] 2023-05-28(Sun) 11:46:37.228
[ANC] 2023-05-28(Sun) 02:46:37.233
TimeZone: ANC
SerialNumber: No.31
TimeDifference: UTC - 9
City: アメリカ合衆国 / アンカレジ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 02
Minutes: 46
Seconds: 37
Milliseconds: 228
[UTC] 2023-05-28(Sun) 11:46:37.254
[YVR] 2023-05-28(Sun) 03:46:37.255
TimeZone: YVR
SerialNumber: No.32
TimeDifference: UTC - 8
City: カナダ / バンクーバー
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 03
Minutes: 46
Seconds: 37
Milliseconds: 254
[UTC] 2023-05-28(Sun) 11:46:37.278
[LAX] 2023-05-28(Sun) 03:46:37.280
TimeZone: LAX
SerialNumber: No.33
TimeDifference: UTC - 8
City: アメリカ合衆国 / ロサンゼルス
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 03
Minutes: 46
Seconds: 37
Milliseconds: 278
[UTC] 2023-05-28(Sun) 11:46:37.303
[DEN] 2023-05-28(Sun) 04:46:37.304
TimeZone: DEN
SerialNumber: No.34
TimeDifference: UTC - 7
City: アメリカ合衆国 / デンバー
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 04
Minutes: 46
Seconds: 37
Milliseconds: 302
[UTC] 2023-05-28(Sun) 11:46:37.327
[MEX] 2023-05-28(Sun) 05:46:37.330
TimeZone: MEX
SerialNumber: No.35
TimeDifference: UTC - 6
City: メキシコ / メキシコシティー
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 05
Minutes: 46
Seconds: 37
Milliseconds: 327
[UTC] 2023-05-28(Sun) 11:46:37.356
[CHI] 2023-05-28(Sun) 05:46:37.359
TimeZone: CHI
SerialNumber: No.36
TimeDifference: UTC - 6
City: アメリカ合衆国 / シカゴ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 05
Minutes: 46
Seconds: 37
Milliseconds: 355
[UTC] 2023-05-28(Sun) 11:46:37.383
[NYC] 2023-05-28(Sun) 06:46:37.384
TimeZone: NYC
SerialNumber: No.37
TimeDifference: UTC - 5
City: アメリカ合衆国 / ニューヨーク
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 06
Minutes: 46
Seconds: 37
Milliseconds: 383
[UTC] 2023-05-28(Sun) 11:46:37.408
[YMQ] 2023-05-28(Sun) 06:46:37.410
TimeZone: YMQ
SerialNumber: No.38
TimeDifference: UTC - 5
City: カナダ / モントリオール
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 06
Minutes: 46
Seconds: 37
Milliseconds: 408
[UTC] 2023-05-28(Sun) 11:46:37.432
[MAO] 2023-05-28(Sun) 07:46:37.433
TimeZone: MAO
SerialNumber: No.39
TimeDifference: UTC - 4
City: ブラジル / マナウス
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 07
Minutes: 46
Seconds: 37
Milliseconds: 432
[UTC] 2023-05-28(Sun) 11:46:37.456
[BUE] 2023-05-28(Sun) 08:46:37.458
TimeZone: BUE
SerialNumber: No.40
TimeDifference: UTC - 3
City: アルゼンチン / ブエノスアイレス
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 08
Minutes: 46
Seconds: 37
Milliseconds: 456
[UTC] 2023-05-28(Sun) 11:46:37.480
[RIO] 2023-05-28(Sun) 08:46:37.483
TimeZone: RIO
SerialNumber: No.41
TimeDifference: UTC - 3
City: ブラジル / リオデジャネイロ
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 08
Minutes: 46
Seconds: 37
Milliseconds: 480
[UTC] 2023-05-28(Sun) 11:46:37.507
[FEN] 2023-05-28(Sun) 09:46:37.509
TimeZone: FEN
SerialNumber: No.42
TimeDifference: UTC - 2
City: ブラジル / フェルナンド・デ・ノローニャ諸島
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 09
Minutes: 46
Seconds: 37
Milliseconds: 507
[UTC] 2023-05-28(Sun) 11:46:37.535
[PDL] 2023-05-28(Sun) 10:46:37.537
TimeZone: PDL
SerialNumber: No.43
TimeDifference: UTC - 1
City: ポルトガル領 / アゾレス諸島
FullYear: 2023
Month: 05
Date: 28
Day: Sun
Hours: 10
Minutes: 46
Seconds: 37
Milliseconds: 535
--AvailableCities(43) begin--
LON (UTC + 0): No.01 イギリス / ロンドン
MAD (UTC + 1): No.02 スペイン / マドリード
PAR (UTC + 1): No.03 フランス / パリ
ROM (UTC + 1): No.04 イタリア / ローマ
BER (UTC + 1): No.05 ドイツ / ベルリン
CAI (UTC + 2): No.06 エジプト / カイロ
AHI (UTC + 2): No.07 ギリシャ / アテネ
JNB (UTC + 2): No.08 南アフリカ共和国 / ヨハネスブルグ
RUH (UTC + 3): No.09 サウジアラビア / リヤド
THR (UTC + 3.5): No.10 イラン / テヘラン
DXB (UTC + 4): No.11 アラブ首長国連邦 / ドバイ
KBL (UTC + 4.5): No.12 アフガニスタン / カブール
KHI (UTC + 5): No.13 パキスタン / カラチ
DEL (UTC + 5.5): No.14 インド / デリー
DAC (UTC + 6): No.15 バングラデシュ / ダッカ
RGN (UTC + 6.5): No.16 ミャンマー / ヤンゴン
BKK (UTC + 7): No.17 タイ / バンコク
SIN (UTC + 8): No.18 シンガポール / シンガポール
HKG (UTC + 8): No.19 香港特別行政区 / 香港
BJS (UTC + 8): No.20 中華人民共和国 / 北京
TPE (UTC + 8): No.21 台湾地区 / 台北
TYO (UTC + 9): No.22 日本 / 東京
SEL (UTC + 9): No.23 韓国 / ソウル
ADL (UTC + 9.5): No.24 オーストラリア / アデレード
SYD (UTC + 10): No.25 オーストラリア / シドニー
NOU (UTC + 11): No.26 ニューカレドニア / ヌーメア
AKL (UTC + 12): No.27 ニュージーランド / オークランド
SUV (UTC + 12): No.28 フィジー諸島共和国 / スバ
MDY (UTC - 11): No.29 アメリカ合衆国 / ミッドウェー諸島
HNL (UTC - 10): No.30 アメリカ合衆国 / ホノルル
ANC (UTC - 9): No.31 アメリカ合衆国 / アンカレジ
YVR (UTC - 8): No.32 カナダ / バンクーバー
LAX (UTC - 8): No.33 アメリカ合衆国 / ロサンゼルス
DEN (UTC - 7): No.34 アメリカ合衆国 / デンバー
MEX (UTC - 6): No.35 メキシコ / メキシコシティー
CHI (UTC - 6): No.36 アメリカ合衆国 / シカゴ
NYC (UTC - 5): No.37 アメリカ合衆国 / ニューヨーク
YMQ (UTC - 5): No.38 カナダ / モントリオール
MAO (UTC - 4): No.39 ブラジル / マナウス
BUE (UTC - 3): No.40 アルゼンチン / ブエノスアイレス
RIO (UTC - 3): No.41 ブラジル / リオデジャネイロ
FEN (UTC - 2): No.42 ブラジル / フェルナンド・デ・ノローニャ諸島
PDL (UTC - 1): No.43 ポルトガル領 / アゾレス諸島
--AvailableCities(43) end--
c:\node\test>
都市名43種類はCITIZENのwebサイトに載っている都市名と同じ値にしておいた。
世界の時差について|時計の知識 | シチズンウオッチ オフィシャルサイト [CITIZEN-シチズン] ExternalLink