-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
72 lines (70 loc) · 1.86 KB
/
script.js
File metadata and controls
72 lines (70 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//get today's time-stamp;
var today = new Date();
//return time in (HH:MM:SS) format;
document.getElementById('current-time').innerHTML = (today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds()).fontsize(6);
document.getElementById('current-time-zone').innerHTML = new Date();
//get query region;
let selection = document.querySelector('select');
//get header tag to return query result;
let result = document.querySelector('h5');
//show selected region;
let header_tag = document.querySelector('h2');
//Date and Time of the selected location;
var aryIannaTimeZones =
[
"Australia/Brisbane",
"America/New_York",
"Asia/Kolkata",
"Europe/Andorra",
"Asia/Dubai",
"Asia/Kabul",
"Europe/Tirane",
"Australia/Melbourne",
"Australia/Sydney",
"Australia/Broken_Hill",
"Australia/Lindeman",
"Australia/Adelaide",
"Australia/Darwin",
"Australia/Perth",
"Australia/Eucla",
"Asia/Baku",
"America/Barbados",
"Asia/Dhaka",
"Europe/Brussels",
"Europe/Sofia",
"Atlantic/Bermuda",
"Asia/Brunei",
"America/La_Paz",
"America/Cuiaba",
"Indian/Cocos",
"Europe/Zurich",
"Africa/Abidjan",
"Pacific/Rarotonga",
"America/Santiago",
"America/Punta_Arenas",
"Pacific/Easter",
"Asia/Shanghai",
"Asia/Urumqi",
"America/Bogota",
"America/Costa_Rica",
"America/Havana",
"Atlantic/Cape_Verde",
"America/Curacao",
"Indian/Christmas",
"America/Guyana",
"Asia/Hong_Kong",
"America/Tegucigalpa",
"America/Port-au-Prince",
"Asia/Jakarta",
"Europe/Simferopol",
"America/Caracas"
];
selection.addEventListener('change', () => {
//get query index to get query output;
var cnt = selection.selectedIndex;
var date_time = new Date().toLocaleString("en-US", {timeZone: aryIannaTimeZones[cnt-1]});
//return selected region name;
header_tag.innerText = "Your selected region:: " + aryIannaTimeZones[cnt-1];
//return query result;
result.innerText = date_time;
});