No.484956
<script>
// 目標日時(日本時間)
const targetTime = new Date("2025-12-13T13:05:00+09:00");
function updateCountdown() {
const now = new Date();
const diff = targetTime - now;
const el = document.getElementById("countdown");
if (diff <= 0) {
el.textContent = "カウントダウン終了!";
clearInterval(timerId);
return;
}
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor((diff / (1000 * 60 * 60)) % 24);
const mins = Math.floor((diff / (1000 * 60)) % 60);
const secs = Math.floor((diff / 1000) % 60);
el.textContent =
"試合開始まで " +
days + "日 " +
hours.toString().padStart(2, "0") + "時間 " +
mins.toString().padStart(2, "0") + "分 " +
secs.toString().padStart(2, "0") + "秒";
}
const timerId = setInterval(updateCountdown, 1000);
updateCountdown();
</script>