Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
1
Indexable
Never
<!DOCTYPE html>
<html>
<head>
    <title>Julian Clock and Date</title>
</head>
<body>
    <div id="clock"></div>
    <div id="date"></div>

    <script>
        function updateClock() {
            const now = new Date();
            const hours = now.getHours().toString().padStart(2, '0');
            const minutes = now.getMinutes().toString().padStart(2, '0');
            const seconds = now.getSeconds().toString().padStart(2, '0');
            const timeString = `${hours}:${minutes}:${seconds}`;
            document.getElementById('clock').textContent = timeString;

            const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
            const year = now.getFullYear();
            const month = months[now.getMonth()];
            const day = now.getDate();
            const dateString = `${day} ${month} ${year}`;
            document.getElementById('date').textContent = dateString;

            // Add your Julian date calculation here if needed
        }

        // Update the clock and date every second
        setInterval(updateClock, 1000);

        // Initial update
        document.addEventListener('DOMContentLoaded', () => {
            updateClock();
        });
    </script>
</body>
</html>