Skip to content

Commit

Permalink
Create time_left_in_this_month.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ShoroukAziz authored Oct 8, 2020
1 parent fec4744 commit 44d0ace
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions time_left_in_this_month.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Fjalla+One&display=swap" rel="stylesheet">

<title>Time Left in 2020</title>
<style>

body{
text-align: center;
font-family: 'Fjalla One', sans-serif;
background-color: #fff;
}
.box{
display: inline-block;
display: inline-block;
color: #fff;
padding: 10px;
border-radius: 5px;
}
#days{
background-color:#0f4d4f;
}
#hours{
background-color:#4CAF50;
}
#minutes{
background-color:#76250b;
}
h2{
display: inline-block;
margin-right: 10px;
}


</style>
</head>
<body>

<div id="counter">
<h2>
Time left in This Month
</h2>

<h2 class="box" id="days"></h2>
<h2 class="box" id="hours"></h2>
<h2 class="box" id="minutes"></h2>
</div>



<script>
function CountDownTimer () {
left_days = document.getElementById("days");
left_hours = document.getElementById("hours");
left_minutes = document.getElementById("minutes");

}
function showRemaining (){
now = new Date();
days_in_this_month = new Date( now.getFullYear(), now.getMonth()+1, 0).getDate();
days = days_in_this_month- now.getDate();
hours = 23 - now.getHours();
minutes = 59 - now.getMinutes();
left_days.innerHTML = days + " days "
left_hours.innerHTML = hours + " hours "
left_minutes.innerHTML = minutes + " mins "
}

timer = setInterval (showRemaining, 1000)
CountDownTimer() ;
</script>
</body>
</html>

0 comments on commit 44d0ace

Please sign in to comment.