-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (61 loc) · 2 KB
/
index.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.container{
background-color: antiquewhite;
color: black;
padding: 20px;
margin :4px;
border: 2px solid black;
border-radius: 10px;
text-align: center;
font-size: larger;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
Current time is <span id="clock"></span>
</div>
<script>
let time = new Date();
console.log(time);
let timez = new Date(0);
console.log(timez);
let newDate = new Date("2029-09-30");
console.log(newDate)
let newDate2 = new Date(2001, 11, 14, 20, 00, 00);
console.log(newDate2);
let yr = newDate2.getFullYear();
console.log("The year is ", yr);
let mon = newDate2.getMonth();
console.log("The month is ", mon);
let date = newDate2.getDate();
console.log("The date is ", date);
let hour = newDate2.getHours();
console.log("The hours is ", hour);
let min = newDate2.getMinutes();
console.log("The minute is ", min);
newDate2.setDate(8); //set year, month, hour, day, min, sec also available
console.log(newDate2);
newDate2.setDate(-9 * 28);//It automatically add the date according to the days in a month
console.log(newDate2);
let total_time = Date.now() //Total number fo time from 1 jan 1970 in millisec
console.log(total_time);
newDate.setDate(8);
newDate.setMinutes(29);
newDate.setMonth(2);
console.log(newDate)
setInterval(updateTime, 1000);
function updateTime() {
clock.innerHTML = new Date();
}
</script>
</body>
</html>