Created
August 31, 2018 11:00
-
-
Save byeblogs/c3fff35c376c3a84b0c49c8ecccbf27d to your computer and use it in GitHub Desktop.
Check diff range of hours, minutes, second in Javascript..
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 startTime = moment('12:00:01', 'hh:mm:ss a'); | |
var endTime = moment('13:00:10' , 'hh:mm:ss a'); | |
var totalHours = (endTime.diff(startTime, 'hours')); | |
var totalMinutes = endTime.diff(startTime, 'minutes'); | |
var clearMinutes = totalMinutes % 60; | |
console.log(totalHours + " hours and " + clearMinutes + " minutes"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment