Created
April 15, 2020 04:25
-
-
Save squalvj/4c586569f37f28ef50996233565e9320 to your computer and use it in GitHub Desktop.
Minute, Second, Hour Calculation
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
const time = 3600 //second 1 hour | |
var minutes = Math.floor(time / 60); | |
//And to get the remaining seconds, multiply the full minutes with 60 and subtract from the total seconds: | |
var seconds = time - minutes * 60; | |
//Now if you also want to get the full hours too, divide the number of total seconds by 3600 (60 minutes/hour · 60 seconds/minute) first, then calculate the remaining seconds: | |
var hours = Math.floor(time / 3600); | |
time = time - hours * 3600; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment