-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJavascript1.html
More file actions
39 lines (37 loc) · 1.13 KB
/
Javascript1.html
File metadata and controls
39 lines (37 loc) · 1.13 KB
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
<html>
<head>
<title>ASSIGNMENT 1</title>
<h1>Current Date and Time</h1>
</head>
<body bgcolor="Yellow">
<script>
var date=new Date();
var day=date.getDay();
var wdays=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
document.write("Today is:" +wdays[day]);
document.write("<br/>");
var hours=date.getHours();
if(hours>=12)
{
var t="PM";
}
else
{
var t="AM";
}
hours=hours%12;
hours=hours?hours:12;
var minutes=date.getMinutes();
if(minutes<10)
{
minutes='0'+minutes;
}
else
{
minutes=minutes;
}
var time=hours +" "+t+" : "+minutes+" : "+date.getSeconds();
document.write("\t current time is :" + time);
</script>
</body>
</html>