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();
 var timer_month=05;
 var timer_day=25;
 var timer_year=currentTime.getFullYear()+1;
 var timer_hour=10;
 var timer_min=30;
 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)
 //document.getElementById("timer_value").innerHTML = 'Reached!';
 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

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>

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

Author: Mukesh Jakhar

This is Mukesh Jakhar. I’m a professional web developer with 3+ years experience. I am always ready for freelance work and i am writing blogs in my free time. I love to learn new technologies and share with others.
I founded PHPKIDA in September 2015. The focus of this website to provide web development tutorials of PHP, WordPress, CodeIgniter, Jquery, MySQL, HMTL, CSS etc and sharing solution of problems which i already solved.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

How to get the value of HTML tag using JS

JavaScript validation on image field

html5 video tag Complete Guide

Getting The Screen Resolution Using JavaScript

How to create textbox in html dynamically using javascript

how to disable right click using JavaScript

PHPKIDA Offering Free Tools:


Free online tool to download Instagram videos, photos and save Instagram videos, photos to your device. It's free & easy to use.

Download Now


Our real time currency converter calculator will convert your money based on current values from around the world. It's free & easy to use.

Convert Now


Create robots txt file that help search engines to crawling and indexing your site with help of our free online Robots.txt Generator tool.

Create Now


Free online tool to minify or compress html code and reduce the size of html code in few clicks. It's free & easy to use.

Minify Now


Free online tool to minify or compress css code and reduce the size of css code in few clicks. It's free & easy to use.

Minify Now


Free online tool to minify or compress javascript code and reduce the size of javascript code in few clicks. It's free & easy to use.

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.