I have to Make a countdown page for the upcoming ICC cricket world cup event that shows remaining days in below format.
Format #1: 01 months 10 days 10 hours
Format 2: 01 hours 20 minute 10 seconds (If <2 days remaining)
and the below code is what i have right now. How do i solve this, please help:
body {
   background-image: url("https://www.somersetcountycc.co.uk/wp-content/uploads/2018/09/getimage.png");
   background-size: 100%;
  
  }
  .countdownContainer{
   position: absolute;;
   top: 50%;
   left: 50%;
   transform : translateX(-50%) translateY(-50%);
   text-align: center;
   background: rgba(221, 221, 221, 0.8);
   border: 1px solid #999;
   padding: 10px;
   box-shadow: 0 0 5px 3px #ccc;
  }
  .info {
   font-size: 50px;
  }<!DOCTYPE html>
<html>
 <head>
  <title>ICC World cup 2019 countdown</title>
  <link rel="stylesheet" type="text/css" href="style.css">
 </head>
 <body>
  <table class="countdownContainer" id="mytable">
   <tr class="info">
    <td colspan="5">Countdown to ICC World Cup 2019:</td>
   </tr>
   <tr class="info">
    <td id="months"></td>
    <td id="days"></td>
    <td id="hours"></td>
    <td id="minutes"></td>
    <td id="seconds"></td>
   </tr>
   <tr>
    <td>Months</td>
    <td>Days</td>
    <td>Hours</td>
    <td>Minutes</td>
    <td>Seconds</td>
   </tr>
  </table>
  <script type="text/javascript">
   function countdown(){
    let now = new Date();
    let eventDate = new Date("May 30, 2019 15:00:00");
    let currentTiime = now.getTime();
    let eventTime = eventDate.getTime();
    let remTime = eventTime - currentTiime;
    let s = Math.floor(remTime / 1000);
    let m = Math.floor(s / 60);
    let h = Math.floor(m / 60);
    let d = Math.floor(h / 24);
    let mo = Math.floor(d / 30);
    mo %= 30;
    h %= 24;
    m %= 60;
    s %= 60;
    mo = (mo < 10) ? "0"+mo : mo;
    h = (h < 10) ? "0" + h : h;
    m = (m < 10) ? "0" + m : m;
    s = (s < 10) ? "0" + s : s;
    if(d>2){
     document.getElementById("months").textContent = mo;
     document.getElementById("days").textContent = d;
     document.getElementById("hours").textContent = h;
    }
    else{
     document.getElementById("hours").textContent = h;
     document.getElementById("minutes").textContent = m;
     document.getElementById("seconds").textContent = s;
    }
    setTimeout(countdown, 1000);
   }
   countdown();
  </script>
 </body>
</html>I have modified the code again...
 
    