Created
December 16, 2014 13:19
-
-
Save BrunoQuaresma/8358b0cd209ee5f14758 to your computer and use it in GitHub Desktop.
Time for JS
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
function Time(str){ | |
"use strict"; | |
var values = str.split(':'), | |
seconds = parseInt(values[2]), | |
minutes = parseInt(values[1]), | |
hours = parseInt(values[0]); | |
this.getSeconds = function(){ | |
return seconds; | |
} | |
this.getMinutes = function(){ | |
return seconds; | |
} | |
this.getHours = function(){ | |
return seconds; | |
} | |
this.convertToMiliseconds = function(){ | |
return (seconds + (minutes * 60) + (hours * 60 * 60)) * 1000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment