Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
real time remaining time with javascript

I want to show remaining time inside a foreach loop. I want to show difference between activationEndTime column and current time in database;

this code is not working well for me what should I do?

(function() {
  const second = 1000,
    minute = second * 60,
    hour = minute * 60,
    day = hour * 24
  let myTime = '<?= $key->activationEndTime?>'
  countDown = new Date(myTime).getTime(),
    x = setInterval(function() {
      let now = new Date().getTime(),
        fark = countDown - now;
      document.getElementById("minutesx").innerText = Math.floor((fark % hour) / minute);
      if (0 >= fark) {
        clearInterval(x);
        document.getElementById("countdown-Key").innerHTML = '<span>Süre Doldu</span>'
      }
    }, 0)
}());
<div class="sverification-inner" id="countdown-Key">
  <ul style="text-align: center">
    <li>
      <span id="minutesx" class="timers"></span>
      <span class="times">DAKİKA</span>
    </li>
  </ul>
</div>

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!