How to Add a Countdown Timer to Weebly

/, Tutorials/How to Add a Countdown Timer to Weebly

How to Add a Countdown Timer to Weebly

This article explains how one can add a countdown timer to Weebly. Countdown timers can be used in several situations. They are useful in case of any events. For example, future event, such as wedding, birthday, graduation, begin of a major sale, the next holiday, and so on.

Add a Countdown Timer to Weebly

#1. Add a Countdown Timer  using a Weebly App

The most easiest and most-forward way is to simply add a Weebly app that does the job. Lots of apps dedicated to such features. Here’s one of them that allows us to add a countdown timer.

add countdown timer to weebly

#2. Manually Add a Countdown Timer  to Weebly

You can use the Embed Code element in Weebly to manually add this feature. You will just need to add a Javascript code to your Weebly website and the countdown timer will display.

Here are the lines of code that you can copy paste in order to have the above countdown timer:

// Set the date we’re counting down to
var countDownDate = new Date(“Sep 5, 2018 15:37:25”).getTime();

// Update the count down every 1 second
var x = setInterval(function() {

  // Get todays date and time
  var now = new Date().getTime();

  // Find the distance between now an the count down date
  var distance = countDownDate – now;

  // Time calculations for days, hours, minutes and seconds
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);

  // Display the result in the element with id=”demo”
  document.getElementById(“demo”).innerHTML = days + “d ” + hours + “h “
  + minutes + “m ” + seconds + “s “;

  // If the count down is finished, write some text 
  if (distance < 0) {
    document.getElementById(“demo”).innerHTML = “EXPIRED”;
}, 1000);

You can for sure look for any other countdown timer code in Google and add it using the same method.

We hope this article helped you learn how to add a countown timer in Weebly. You may also want to see our guide on how to embed Javascript code in Weebly.

If you liked this tutorial, then you may consider subscribing to our WeeblyTutorials YouTube Channel for Weebly video tutorials. You can also find us on Twitter and Facebook.

By | 2018-01-05T03:35:21+00:00 January 5th, 2018|Beginners Guide, Tutorials|0 Comments

About the Author:

Editorial Staff at WeeblyTutorials is a team of Weebly experts.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.