Created
March 17, 2014 14:30
-
-
Save anmonteiro/9600256 to your computer and use it in GitHub Desktop.
Little function to get the remaining time until a target date - still WIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getCountdown = function(targetDate){ | |
var left = targetDate.getTime() - new Date().getTime(); | |
var seconds = + ((left / 1000) % 60) ; | |
var minutes = + ((left / (1000*60)) % 60); | |
var hours = + ((left / (1000*60*60))); | |
return hours.toFixed(0)+' h '+minutes.toFixed(0)+' min '+seconds.toFixed(0) + ' s'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment