Upload forex_market_hours.html
Browse files- forex_market_hours.html +102 -0
forex_market_hours.html
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html>
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<title>Forex Market Hours</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
background-color: #0f0f0f;
|
| 10 |
+
color: white;
|
| 11 |
+
font-family: sans-serif;
|
| 12 |
+
max-width: 415px;
|
| 13 |
+
margin: 0 auto;
|
| 14 |
+
padding: 20px;
|
| 15 |
+
}
|
| 16 |
+
h2 {
|
| 17 |
+
text-align: center;
|
| 18 |
+
color: #00ccff;
|
| 19 |
+
}
|
| 20 |
+
table {
|
| 21 |
+
width: 100%;
|
| 22 |
+
border-collapse: collapse;
|
| 23 |
+
margin-top: 10px;
|
| 24 |
+
}
|
| 25 |
+
th, td {
|
| 26 |
+
border: 1px solid #333;
|
| 27 |
+
padding: 8px;
|
| 28 |
+
text-align: center;
|
| 29 |
+
}
|
| 30 |
+
th {
|
| 31 |
+
background-color: #222;
|
| 32 |
+
}
|
| 33 |
+
tr:nth-child(even) {
|
| 34 |
+
background-color: #1a1a1a;
|
| 35 |
+
}
|
| 36 |
+
</style>
|
| 37 |
+
</head>
|
| 38 |
+
<body>
|
| 39 |
+
<h2>Forex Market Hours (Live)</h2>
|
| 40 |
+
<p id="localtime" style="text-align:center; margin-bottom:10px;"></p>
|
| 41 |
+
<table>
|
| 42 |
+
<thead>
|
| 43 |
+
<tr>
|
| 44 |
+
<th>Center</th>
|
| 45 |
+
<th>Status</th>
|
| 46 |
+
<th>Time Left</th>
|
| 47 |
+
<th>Start (UTC)</th>
|
| 48 |
+
<th>End (UTC)</th>
|
| 49 |
+
</tr>
|
| 50 |
+
</thead>
|
| 51 |
+
<tbody id="session-table">
|
| 52 |
+
</tbody>
|
| 53 |
+
</table>
|
| 54 |
+
|
| 55 |
+
<script>
|
| 56 |
+
const sessions = [
|
| 57 |
+
{center: "Sydney", start: 22, end: 6},
|
| 58 |
+
{center: "Tokyo", start: 0, end: 8},
|
| 59 |
+
{center: "London", start: 7, end: 15},
|
| 60 |
+
{center: "New York", start: 12, end: 20},
|
| 61 |
+
];
|
| 62 |
+
|
| 63 |
+
function updateTable() {
|
| 64 |
+
const now = new Date();
|
| 65 |
+
const nowUTC = new Date(now.getTime() + now.getTimezoneOffset() * 60000);
|
| 66 |
+
document.getElementById("localtime").innerHTML = "Local Time: <b>" + now.toLocaleTimeString() + "</b>";
|
| 67 |
+
|
| 68 |
+
const table = document.getElementById("session-table");
|
| 69 |
+
table.innerHTML = "";
|
| 70 |
+
|
| 71 |
+
sessions.forEach(s => {
|
| 72 |
+
let startUTC = new Date(nowUTC);
|
| 73 |
+
startUTC.setUTCHours(s.start, 0, 0, 0);
|
| 74 |
+
let endUTC = new Date(nowUTC);
|
| 75 |
+
endUTC.setUTCHours(s.end, 0, 0, 0);
|
| 76 |
+
|
| 77 |
+
if (s.end < s.start) {
|
| 78 |
+
if (nowUTC.getUTCHours() < s.start) startUTC.setUTCDate(startUTC.getUTCDate() - 1);
|
| 79 |
+
else endUTC.setUTCDate(endUTC.getUTCDate() + 1);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
let isOpen = nowUTC >= startUTC && nowUTC <= endUTC;
|
| 83 |
+
let timeLeft = isOpen ? new Date(endUTC - nowUTC).toISOString().substr(11, 8) : "-";
|
| 84 |
+
let statusColor = isOpen ? "#00cc66" : "#999";
|
| 85 |
+
|
| 86 |
+
table.innerHTML += `
|
| 87 |
+
<tr>
|
| 88 |
+
<td>${s.center}</td>
|
| 89 |
+
<td style="color:${statusColor}; font-weight:bold;">${isOpen ? "Open" : "Closed"}</td>
|
| 90 |
+
<td>${timeLeft}</td>
|
| 91 |
+
<td>${s.start.toString().padStart(2, '0')}:00</td>
|
| 92 |
+
<td>${s.end.toString().padStart(2, '0')}:00</td>
|
| 93 |
+
</tr>
|
| 94 |
+
`;
|
| 95 |
+
});
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
updateTable();
|
| 99 |
+
setInterval(updateTable, 1000);
|
| 100 |
+
</script>
|
| 101 |
+
</body>
|
| 102 |
+
</html>
|