Introduction
Time JavaScript Code with HTML
Time Zone
- America/New_York
- America/Toronto
- Asia/Seoul
- Asia/Tokyo
- Australia/Queensland
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style></style>
</head>
<body>
<p id="Seoul-Time"></p>
<p id="Toronto-Time"></p>
<p id="NewYork-Time"></p>
<p id="Tokyo-Time"></p>
<p id="Queensland-Time"></p>
<br />
<script>
let module_time = (function () {
function a() {
let newyorkTime = new Date().toLocaleString("en-US", {
timeZone: "America/New_York",
});
let torontoTime = new Date().toLocaleString("en-US", {
timeZone: "America/Toronto",
});
let seoulTime = new Date().toLocaleString("en-US", {
timeZone: "Asia/Seoul",
});
let tokyoTime = new Date().toLocaleString("en-US", {
timeZone: "Asia/Tokyo",
});
let queenslandTime = new Date().toLocaleString("en-Us", {
timeZone: "Australia/Queensland",
});
// Time by Location
document.getElementById("NewYork-Time").innerHTML =
"New york: " + newyorkTime;
document.getElementById("Toronto-Time").innerHTML =
"Toronto: " + torontoTime;
document.getElementById("Seoul-Time").innerHTML =
"Seoul: " + seoulTime;
document.getElementById("Tokyo-Time").innerHTML =
"Tokyo: " + tokyoTime;
document.getElementById("Queensland-Time").innerHTML =
"Queensland: " + queenslandTime;
}
a();
// Update the count down every 1 second
let x = setInterval(function () {
// Get today's date and time
a();
}, 1000);
})();
</script>
</body>
</html>
let seoulTime = new Date().toLocaleString("en-US", { timeZone: "Asia/Seoul" });
- Seoul time
Learn more: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones