<div id="countdown">
<h1>Cùng đếm ngược đến năm mới 2025! 🎉</h1>
<div id="timer">
<div><span id="days">00</span><p>Ngày</p></div>
<div><span id="hours">00</span><p>Giờ</p></div>
<div><span id="minutes">00</span><p>Phút</p></div>
<div><span id="seconds">00</span><p>Giây</p></div>
</div>
</div>
<style>
#countdown {
text-align: center;
font-family: Arial, sans-serif;
background: linear-gradient(to bottom, #2c3e50, #3498db);
color: #fff;
padding: 20px;
border-radius: 10px;
}
h1 {
font-size: 24px;
margin-bottom: 20px;
}
#timer {
display: flex;
justify-content: center;
gap: 20px;
}
#timer div {
background: rgba(255, 255, 255, 0.1);
padding: 10px;
border-radius: 10px;
width: 70px;
}
#timer span {
font-size: 20px;
display: block;
}
#timer p {
margin: 5px 0 0;
font-size: 14px;
color: #ddd;
}
</style>
<script type="text/javascript">
(function() {
function countdown() {
const targetDate = new Date("January 1, 2025 00:00:00").getTime();
const now = new Date().getTime();
const gap = targetDate - now;
if (gap <= 0) {
document.getElementById("countdown").innerHTML = "<h1>Happy New Year 2025!</h1>";
return;
}
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;
const days = Math.floor(gap / day);
const hours = Math.floor((gap % day) / hour);
const minutes = Math.floor((gap % hour) / minute);
const seconds = Math.floor((gap % minute) / second);
document.getElementById("days").innerText = days;
document.getElementById("hours").innerText = hours;
document.getElementById("minutes").innerText = minutes;
document.getElementById("seconds").innerText = seconds;
}
setInterval(countdown, 1000);
})();
</script>