JavaScript timer countdown days hours minutes seconds

JavaScript timer countdown days hours minutes seconds

Today we are going to tell you how we can make JavaScript countdown timers in simple way, which makes timer day hour minute seconds count one by one. This is built using full javascript and css short and sweet.
You can use it on your webpage, like on the Coming Soon page, to show special offers, and to show GDPR countdown and end up with you want.
This javascript timer countdown very simple and 100% responsive with mobile and tablet devices means countdown timer flexible with every kind of device.

JavaScript Code For Timer Countdown

<script type="text/javascript">
var timer;
function settimer()
{
 currentTime = new Date();
 clearInterval(timer);
 var timer_month=05;
 var timer_day=25;
 var timer_year=currentTime.getFullYear()+1;
 var timer_hour=10;
 if(timer_hour=="")timer_hour=0;
 var timer_min=30;
 if(timer_min=="")timer_min=0;
 
 var timer_date=timer_month+"/"+timer_day+"/"+timer_year+" "+timer_hour+":"+timer_min;
 var end = new Date(timer_date); // Arrange values in Date Time Format
 var now = new Date(); // Get Current date time
 var second = 1000; // Total Millisecond In One Sec
 var minute = second * 60; // Total Sec In One Min
 var hour = minute * 60; // Total Min In One Hour
 var day = hour * 24; // Total Hour In One Day
 
 function showtimer() {
 var now = new Date();
 var remain = end - now; // Get The Difference Between Current and entered date time
 if(remain < 0)
 {
 clearInterval(timer);
 //document.getElementById("timer_value").innerHTML = 'Reached!';
 return;
 }
 var days = Math.floor(remain / day); // Get Remaining Days
 var hours = Math.floor((remain % day) / hour); // Get Remaining Hours
 var minutes = Math.floor((remain % hour) / minute); // Get Remaining Min
 var seconds = Math.floor((remain % minute) / second); // Get Remaining Sec
 document.getElementById("timerDays").innerHTML = days;
 document.getElementById("timerHours").innerHTML = hours;
 document.getElementById("timerMinutes").innerHTML = minutes;
 document.getElementById("timerSeconds").innerHTML = seconds;
 }
 timer = setInterval(showtimer, 1000); // Display Timer In Every 1 Sec
}
settimer();
</script>

CSS Code For Timer Countdown

.timerOuterDiv{width: 275px; margin: auto;}
.timerDiv1{text-align:center; margin-bottom: 10px; font-size: 22px;}
.timerDiv{float: left; width: 85px; text-align: center; background: #1f6098; color: #ffffff; border-radius: 4px; margin-left: 5px; padding-bottom: 13px;}
.timerDiv h4{font-size: 40px; margin: 6px 0px;}
#timerDays{font-size: 90px; margin-bottom: 0px; margin-top: 0px;}

HTML Code For Timer Countdown

<div class="timerOuterDiv">
 <div class="timerDiv1"><h4 id="timerDays"></h4> Days</div>
 <div class="timerDiv"><h4 id="timerHours"></h4> Hours</div>
 <div class="timerDiv"><h4 id="timerMinutes"></h4> Minutes</div>
 <div class="timerDiv"><h4 id="timerSeconds"></h4> Seconds</div>
</div>

Article Name: JavaScript timer countdown days hours minutes seconds
Publish Date:
Responsive : 100%, With every device
Keywords: javascript timer countdown with seconds, javascript countdown timer code, javascript countdown timer minutes seconds, javascript countdown to date, countdown timer in html, javascript countdown timer hours minutes seconds, jquery countdown timer, simple countdown timer html

Leave a Reply

Related Posts: You may like

How To Create a Modal Popup With CSS and JavaScript

Get Latitude Longitude from Address

cookie policy popup

How to make a sticky sidebar on scroll

PHPKIDA Offering Free Tools:

INSTA DOWNLOADER

Download Instagram Videos & Photos.

Download Now

CURRENCY CONVERTER

Real Time Currency Converter

Convert Now

ROBOST.TXT GEN.

Robots.txt File Creater

Create Now

HTML MINIFIER

Compress yout HTML Code

Minify Now

CSS MINIFIER

Compress yout CSS Code

Minify Now

JAVASCRIPT MINIFIER

Compress yout JavaScript Code

Minify Now

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.