-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
48 lines (38 loc) · 1.17 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// function to display date
function renderTime(){
var mydate = new Date();
var year = mydate.getYear();
if(year < 1000){
year +=1900;
}
var day = mydate.getDay();
var month = mydate.getMonth();
var daym = mydate.getDate();
var dayarray = new Array("Sunday","Monday", "Tuersday","Wednesday","Thursday","Friday","Saturday");
var montharray = new Array("January","February", "March","April","May","June","July","August",'September',"October","November","December");
//date section
//Time section
var currentTime = new Date();
var h = currentTime.getHours();
var m = currentTime.getMinutes();
var s = currentTime.getSeconds();
if ( h== 24 ){
h == 0;
} else if (h > 12){
h = h - "0";
}
if( h < 10){
h = "0" + h;
}
if( m < 10){
m = "0" + m;
}
if( s < 10 ){
s = "0";
}
var myClock = document.getElementById("clockDisplay")
myClock.textContent = "" +dayarray[day]+ " "+daym+ " "+montharray[month]+" "+year+ " | " +h+ ":" +m+ ":"+s;
myClock.innerText = "" +dayarray[day]+ " "+daym+ " "+montharray[month]+" "+year+ " | " +h+ ":" +m+ ":"+s;
setTimeout("renderTime()", 1000);
}
renderTime();