-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut_59.html
58 lines (53 loc) · 1.53 KB
/
tut_59.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
<!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>javascript dates</title>
<style>
.container{
font-size: 25px;
background-color: red;
border: 2px solid gray;
padding: 34px;
margin: 10px;
text-align: center;
}
#time{
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
Current time is <spam id="time"></spam>
</div>
<script>
console.log("this is date and time tutorial");
let dt= new Date(0);
console.log(dt);
// let newDate= new Date("2021-04-18");
// console.log(newDate);
let newDate= new Date(2030,4,6,9,3,2,34);
console.log(newDate);
let yr=newDate.getFullYear();
console.log("the year is", yr);
let month=newDate.getMonth();
console.log("the month is", month);
let date=newDate.getDate();
console.log("the year is", date);
let hours=newDate.getHours();
console.log("the year is", hours);
let sec=newDate.getSeconds();
console.log("the seconds is", sec);
newDate.setDate(5);
newDate.setMinutes(55);
console.log(newDate);
setInterval(updatetime,1000);
function updatetime(){
time.innerHTML= new Date();
}
</script>
</body>
</html>