watch.html
Mon Dec 27 2021 13:30:34 GMT+0000 (Coordinated Universal Time)
Saved by
@webCycle
<html>
<head>
<title>Automatic cloac</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="hour">
<div class="display">
</div>
</div>
<script>
setInterval(function(){
const hour=document.querySelector('.display');
let time= new Date();
let sec= time.getSeconds();
let min=time.getMinutes();
let hr=time.getHours();
let day='Am';
if(hr>12){
day='Pm';
hr=hr-12;
}
if(hr==0){
hr=12;
}
if(sec<10){
sec='0'+sec;
}
if(min<10){
sec='0'+sec;
}
if(min<10){
min='0'+min;
}
if(hr<10){
hr='0'+hr;
}
hour.textContent=
hr+':'+min+':'+sec+''+':'+day;
})
</script>
</body>
</html>
content_copyCOPY
Comments