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

249
Views
Intentando crear un temporizador de cuenta regresiva de 24 horas que se reinicie después de la fecha límite

Quiero crear una cuenta regresiva para una fecha y hora establecidas. Cuando llegue la fecha límite, el temporizador se restablecerá a 24 horas. Cada día contará hacia atrás hasta las 14:15.

Este es el código de abajo. Gracias por adelantado.

 (function() { var deadline = '2021/12/30 14:15'; function pad(num, size) { var s = "0" + num; return s.substr(s.length - size); } function getTimeRemaining(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()), seconds = Math.floor((t / 1000) % 60), minutes = Math.floor((t / 1000 / 60) % 60), hours = Math.floor((t / (1000 * 60 * 60)) % 24), days = Math.floor(t / (1000 * 60 * 60 * 24)); return { 'total': t, 'days': days, 'hours': hours, 'minutes': minutes, 'seconds': seconds }; } function clock(id, endtime) { let hours = document.getElementById(id + '-hours') let minutes = document.getElementById(id + '-minutes'); var timeinterval = setInterval(function() { var time = getTimeRemaining(endtime); if (time.total <= 0) { deadline = "een datum" clearInterval(timeinterval); } else { hours.innerHTML = pad(time.hours, 2); minutes.innerHTML = pad(time.minutes, 2); } }, 1000); } clock('js-clock-header', deadline); function clocks(id, endtime) { let hours = document.getElementById(id + '-hours') let minutes = document.getElementById(id + '-minutes'); var timeinterval = setInterval(function() { var time = getTimeRemaining(endtime); if (time.total <= 0) { clearInterval(timeinterval); } else { hours.innerHTML = pad(time.hours, 2); minutes.innerHTML = pad(time.minutes, 2); } }, 1000); } clocks('js-clock', deadline); })();
 <span id="js-clock-header-hours"></span>:<span id="js-clock-header-minutes"></span><br /> <span id="js-clock-hours"></span>:<span id="js-clock-minutes"></span>

about 4 years ago · Juan Pablo Isaza
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!