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

94
Views
¿Por qué estamos dividiendo la diferencia de fechas entre 1000?
var newYear = "1 jan 2022"; function countDates() { var newYearDate = new Date(newYear); var currentDate = new Date(); const days = Math.floor((newYearDate - currentDate) / (1000*60 * 60 * 24)); const hours = Math.floor((newYearDate - currentDate) / (1000 * 60 * 60)); const minutes = Math.floor((newYearDate - currentDate) / (1000 * 60)); const seconds = Math.floor((newYearDate - currentDate) / 1000); console.log(days, hours, minutes,seconds); } countDates();

En este código, resté la fecha inicializada (NewYearDate) con la fecha actual e intenté obtener días, horas, minutos, obtuve la lógica en Internet pero no puedo entender por qué se divide por 1000 para todos los variables (días, horas, minutos).

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Porque cuando la fecha se convierte en un número, el valor está en milisegundos
1 segundo === 1000 milisegundos

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