Created
January 27, 2014 21:30
-
-
Save joshrhoades/8657740 to your computer and use it in GitHub Desktop.
Quick function to format passed in seconds and determine the weeks, days, hours, minutes, and seconds in that time. Returns an object of the values.
This file contains hidden or 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 _formatCount = function(sec) { | |
return { | |
w: Math.floor(sec / 86400 / 7),//weeks | |
d: Math.floor(sec / 86400 % 7),//days | |
h: Math.floor(sec / 3600 % 24),//hours | |
m: Math.floor(sec % 3600 / 60),//minutes | |
s: Math.floor(sec % 3600 % 60)//seconds | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment