Skip to content

Commit 3a04433

Browse files
authored
Merge pull request #232 from Tejas1510/counting
Added the code for counting days
2 parents ff57fc4 + 1a0fb3d commit 3a04433

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

JavaScript/CountingDays/Readme.MD

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Counting Days Javascript Program
2+
3+
4+
### How to use it
5+
```
6+
1. Download the given code
7+
2. Run the index.html file
8+
3. you will ask to enter year,month,day of your required date
9+
4. Hit submit
10+
5. you will be displayed the result
11+
12+
```
13+
## Output
14+
15+
![endpoint](https://github.com/Tejas1510/hacking-tools-scripts/blob/counting/Javascript/CountingDays/images/image1.png)
16+
29.5 KB
Loading

JavaScript/CountingDays/index.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="style.css">
7+
<!-- Latest compiled and minified CSS -->
8+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
9+
<title>Counting Days</title>
10+
</head>
11+
<body>
12+
<h1 class="heading">Counting Days</h1>
13+
<!-- Material form login -->
14+
<form>
15+
<div class="form-group">
16+
<label for="exampleInputEmail1">Year</label>
17+
<input type="text" class="form-control" id="Year" placeholder="Enter Year">
18+
</div>
19+
<div class="form-group">
20+
<label for="exampleInputPassword1">Month</label>
21+
<input type="text" class="form-control" id="month" placeholder="Enter month">
22+
</div>
23+
<div class="form-check">
24+
<label for="exampleInputPassword1">Day</label>
25+
<input type="text" class="form-control" id="day" placeholder="Enter Day">
26+
</div>
27+
</form>
28+
<button class="btn btn-primary" onclick="display()">Submit</button>
29+
30+
<h1 id="finalAns"></h1>
31+
32+
<script>
33+
function display(){
34+
const Year = document.getElementById("Year").value;
35+
const month = document.getElementById("month").value;
36+
const day = document.getElementById("day").value;
37+
const finalAns = document.getElementById("finalAns");
38+
today=new Date();
39+
var newdate=new Date(Year,month,day);
40+
var one_day=1000*60*60*24;
41+
finalAns.innerHTML=(Math.ceil((newdate.getTime()-today.getTime())/(one_day))+
42+
" days left until required date");
43+
}
44+
</script>
45+
46+
47+
</body>
48+
</html>

JavaScript/CountingDays/style.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.heading{
2+
text-align: center;
3+
color: blueviolet;
4+
5+
6+
}
7+
8+
form{
9+
width: 500px;
10+
margin-left: 550px;
11+
margin-top: 20px;
12+
}
13+
.btn{
14+
margin-top: 20px;
15+
align-items: center;
16+
margin-left: 750px;
17+
width: 100px;
18+
}
19+
#finalAns{
20+
padding-top: 30px;
21+
text-align: center;
22+
color: blueviolet;
23+
}

0 commit comments

Comments
 (0)