SCRIPT :-
// script.js
function updateTime() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const timeString = `${hours}:${minutes}:${seconds}`;
document.getElementById('time').textContent = timeString;
// Update the time every second
setInterval(updateTime, 1000);
// Initialize the clock when the page loads
updateTime();
STYLE :-
/* styles.css */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #0c0d03e6;
font-family: 'Arial', sans-serif;
.watch {
background-color: #f4a90765;
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 20px rgba(231, 243, 3, 0.884);
text-align: center;
#time {
font-size: 48px;
color: #150202;
font-family: 'Courier New', monospace;
HTML :-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Watch</title>
<link rel="stylesheet" href="style14.css">
</head>
<body>
<div class="watch">
<div id="time"></div>
</div>
<script src="java14.js"></script>
</body>
</html>