00:00:00:00
Nusxalash
<script>
    const deadlineKun = 29;     // Tugash sanasini kiriting
    const deadlineOy = 8;       // Tugash oyining sanasini kiriting (1-12 gacha) 
    const deadlineYil = 2025;   // Tugash yilining kiriting
    const deadlineVaqt = "23:59"; // Tugash vaqtini belgilang

    const timerFontSizeDesktop = "18px";   // Desktop font-size o'lchami
    const timerFontSizeMobil = "14px";     // Mobil font-size o'lchami
    const timerRang = "black";             // Timer rangi

    document.addEventListener("DOMContentLoaded", function () {
        const el = document.querySelector('.sana');

        // Vaqtni ajratish
        const [soat, minut] = deadlineVaqt.split(":").map(Number);
        const deadline = new Date(deadlineYil, deadlineOy - 1, deadlineKun, soat, minut).getTime();

        // Boshlang‘ich style berish
        function applyStyles() {
            if (window.innerWidth <= 480) {
                el.style.fontSize = timerFontSizeMobil;
            } else if (window.innerWidth <= 1200) {
                el.style.fontSize = "32px"; // Tablet uchun
            } else {
                el.style.fontSize = timerFontSizeDesktop;
            }
            el.style.fontFamily = "Arial";
            el.style.color = timerRang;
            el.style.textAlign = "center"; // Markazda joylash
        }

        window.addEventListener("resize", applyStyles);
        applyStyles();

        // Timer funksiyasi
        function updateTimer() {
            const now = new Date().getTime();
            const t = deadline - now;

            if (t <= 0) {
                el.textContent = "00:00:00:00";
                return;
            }

            const d = String(Math.floor(t / (1000 * 60 * 60 * 24))).padStart(2, "0");
            const h = String(Math.floor((t / (1000 * 60 * 60)) % 24)).padStart(2, "0");
            const m = String(Math.floor((t / (1000 * 60)) % 60)).padStart(2, "0");
            const s = String(Math.floor((t / 1000) % 60)).padStart(2, "0");

            el.textContent = `${d} : ${h} : ${m} : ${s}`;
            requestAnimationFrame(updateTimer);
        }

        updateTimer();
    });
</script>

<div class="sana">00:00:00:00</div>
Zero Block
Click "Block Editor" to enter the edit mode. Use layers, shapes and customize adaptability. Everything is in your hands.
Tilda Publishing
create your own block from scratch