Skip to content

Instantly share code, notes, and snippets.

@UlisesGascon
Created March 7, 2016 19:01
Show Gist options
  • Save UlisesGascon/04d7c0c9494f981cb889 to your computer and use it in GitHub Desktop.
Save UlisesGascon/04d7c0c9494f981cb889 to your computer and use it in GitHub Desktop.
Conversion tiempo ms -> Horas, minutos, segundos y dias
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
@jorgemim
Copy link

4.734039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment