Skip to content
This repository has been archived by the owner on Oct 5, 2020. It is now read-only.

clock website using javascript #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Clock/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

var d=new Date();
console.log([d.getDate(), d.getMonth()+1, d.getFullYear()].join('/'));

function clock(){

var fullDate = new Date();
var hrs=fullDate.getHours();
var min=fullDate.getMinutes();
var sec=fullDate.getSeconds();

var week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var day=fullDate.getDate();
var month=fullDate.getMonth()+1;
var year=fullDate.getFullYear();
var weekday=fullDate.getDay();

if(hrs<10){
hrs="0"+hrs;
}

if(min<10){
min="0"+min;
}

if(sec<10){
sec="0"+sec;
}


if(day<10){
day="0"+day;
}

if(month<10){
month="0"+month;
}


document.getElementById('hrs').innerHTML=hrs;
document.getElementById('mins').innerHTML=":"+min;
document.getElementById('secs').innerHTML=":"+sec;


document.getElementById('day').innerHTML=day;
document.getElementById('month').innerHTML="/"+month;
document.getElementById('year').innerHTML="/"+year;

document.getElementById('weekday').innerHTML=week[weekday];

}

setInterval(clock,1000);
30 changes: 30 additions & 0 deletions Clock/clock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<html>
<meta charset="utf-8">
<title>Date time</title>
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Orbitron&display=swap" rel="stylesheet">

<body>
<div id="time">
<span id="hrs"></span>
<span id="mins"></span>
<span id="secs"></span>

</div>

<div id="date">
<span id="day"></span>
<span id="month"></span>
<span id="year"></span>
<br>
<span id="weekday"></span>

</div>

<script src="app.js" charset="utf-8"></script>
</body>




</html>
Binary file added Clock/joker.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Clock/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

*{
margin-top: 0;
margin-left: 0;

}

body{
background: url("joker.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}

#time{
color:white;
margin-top:250px;
margin-left: 170px;
font-size: 60px;
font-family: 'Orbitron', sans-serif;

}
#date{
color:white;
margin-left:1030px;
font-size: 60px;
margin-top:-68px;
font-family: 'Orbitron', sans-serif;
}

#weekday{
font-size:35px;

}