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 all 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
Binary file not shown.
109 changes: 109 additions & 0 deletions Calculators/Current week number Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<!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> Current week number calculator </title>
<style>
.container {
height: 350px;
margin: auto;
width: 60%;
margin-top: 100px;
background: url('./gssoc2.webp');
border: 4px rgb(13, 7, 7) double;
z-index: -1;
}

h1,
h2 {
margin: auto;
width: 75%;
color: #5e5ea6;
margin-top: 15px;
margin-bottom: 20px;
}

h2 {
color: green;
}

p {
width: 30%;
margin: auto;
}

button {
background-color: rgb(106, 106, 121);
color: white;
margin: 15px;
size: 20px;
padding: 5px;
box-shadow : 0 3px 8px 0 rgb(93, 91, 91),
0 6px 8px 0 rgba(122, 121, 121, 0.08);
border-radius: 20px;
}

button:hover {
background-color: white;
color: black;
border: 2px solid black;
}

@media only screen and (max-width:500px) {
.container {
width: 100%;
height:410px;
}

h2 {
width: 50%;
}

p {
width: 50%;
}
}
@media only screen and (max-width:500px) {
.container{
height:460px;
}
}
</style>
</head>

<body>
<div class="container">
<h1>
Calculate Week Number using user input!!
<br> <br>
</h1>

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

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

<h2 style="width:55%" id="result"></h2>
</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)