Skip to content

Instantly share code, notes, and snippets.

@mishudark
Created February 16, 2011 21:52
Show Gist options
  • Select an option

  • Save mishudark/830315 to your computer and use it in GitHub Desktop.

Select an option

Save mishudark/830315 to your computer and use it in GitHub Desktop.
var hoy = new Date();
var futuro = new Date(2011,02,30);
var diff = futuro-hoy;
diff /= 1000;
var days = Math.floor(diff / (60*60*24) - 27);
diff = diff - (days+27) *(60*60*24);
var hours = Math.floor(diff/(60*60));
diff = diff - hours * (60*60);
var mins = Math.floor( diff / 60 );
var secs = Math.floor(diff - mins * 60);
alert(days+' '+hours+':'+mins+':'+secs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment