Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current Week number Calculator #336

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions Calculators/Current week number Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!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">
<link rel="stylesheet" href="res.css">
<title> Current week number calculator </title>
<style>
.container{
margin: auto;
width: 50%;
margin-top: 100px;
background-color:rgba(95, 95, 94, 0.082);
border:2px solid gray;
}
h2,h3{
margin:auto;
width: 63.5%;
color: #5e5ea6;
margin-top: 15px;
margin-bottom: 20px;
}
p{
width: 30%;
margin: auto;
}
button{
background-color: rgb(106, 106, 121);
color:white;
}
</style>
</head>
<body>
<div class="container">
<h2>
Calculate Week Number using user input
<br> <br>
</h2>

<p> <b> Enter date </b>
<input type="date" id="dateInput1">
<br> <br>

<button onclick="weekNumber()">
Calculate Week Number
</button>
</p>

<h3 style="width:45%" id="result"></h3>
</div>

<script>
function weekNumber() {
var dateinput = document.getElementById("dateInput1").value;
var date1 = new Date(dateinput);
var oneJan = new Date(date1.getFullYear(), 0, 1);
var numberOfDays = Math.floor((date1 - oneJan) / (24 * 60 * 60 * 1000));
var result = Math.ceil((date1.getDay() + 1 + numberOfDays) / 7);
return document.getElementById("result").innerHTML = "Week number of given date is: " + result;
}
</script>
</body>
</html>
16 changes: 16 additions & 0 deletions Calculators/Current week number Calculator/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Current Week Number Calculator

### Functionality :-
This is the calculator which gives the value of the week number accoring to the input date set by the user.


### Built Using :-

- HTML
- CSS
- JavaScript


### Screenshot :-
![Screenshot (203)](https://user-images.githubusercontent.com/90452678/169973703-00eb329e-d64c-48cc-a86a-39bf46de3650.png)

11 changes: 11 additions & 0 deletions Calculators/Current week number Calculator/res.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@media only screen and (max-width:500px){
.container{
width:100%;
}
h2{
width:50%;
}
p{
width:50%;
}
}