-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtml55.html
71 lines (60 loc) · 2.04 KB
/
html55.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
<!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>Date and Time</title>
<style>
.container{
display: flex;
justify-items: center;
align-items: center;
}
#timer{
width: 100%;
font-size: 2rem;
text-align: center;
border: solid 2px black;
background-color: yellow;
padding: 10px 10px;
}
#timer1{
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<!-- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Error placeat illum nemo pariatur harum quae autem possimus dicta fugit quidem, amet doloribus quos neque libero enim doloremque, natus, voluptatibus dolorem?</p> -->
<p id="timer">
Current time is <span id="timer1"></span>
</p>
</div>
<script>
console.log("Dates and Times in Js");
// let newd = new Date();
// let newd = new Date("2098-10-20");
// let newd = new Date(year,month,day,hour,minutes,seconds,miliseconds);
let newd = new Date(3060,10,10,10,10,10,10);
console.log(newd);
let yr = newd.getFullYear();
console.log(yr);
let yr1 = newd.getDate();
console.log(yr1);
// let yr2 = newd.getTime();
// console.log(yr2);
let yr3 = newd.getHours();
console.log(yr3);
let yr4 = newd.getMinutes();
console.log(yr4);
newd.setDate(30);
console.log(newd);
setInterval(timere,1000);
function timere(){
timer1.innerHTML = new Date();
}
// Date.now is function in which we can get the present miliseconds we can use it to check how much time a code took to run a code by using it before the code start then after the code is finished
</script>
</body>
</html>