I want to show two times: the one in your country and the one in Japan with JS
The problem is that the second setInterval stops the first one and I don't know how to make both runs.
The full code
<html>
<head></head>
<body>
<p style="font-size: 20px; font-family: SF Compact Display;">In your region:</p>
<script type="text/javascript">
document.write ('<p><span id="date-time">', new Date().toLocaleString(), '<\/span><\/p>')
if (document.getElementById) onload = function() {
setInterval ("document.getElementById ('date-time').firstChild.data = new Date().toLocaleString()", 50)
}
</script>
<p style="font-size: 20px; font-family: SF Compact Display;">In Japan:</p>
<script type="text/javascript">
var asiaTime = new Date().toLocaleString("en-US", {timeZone: "Asia/Tokyo"});
asiaTime = new Date(asiaTime);
var options = {dateStyle: 'medium', hour:'numeric', minute:'numeric', second:'numeric'}
console.log('Asia time: '+asiaTime.toLocaleString(options))
document.write ('<p><span id="japantime">', asiaTime, '<\/span><\/p>')
if (document.getElementById) onload = function() {
function japanTime() {
document.getElementById('japantime').firstChild.data = asiaTime
}
setInterval ("document.getElementById ('japantime').firstChild.data = new Date().toLocaleString()", 50)
}
</script>
</body>
</html>
If someone could help me it will be super cool!