Created
January 27, 2017 11:24
-
-
Save pawiromitchel/72b87cd5ed51704423e596c8f074e594 to your computer and use it in GitHub Desktop.
JS - Calculate the difference between 2 dates
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 daysBetween(one, another) { | |
return Math.round(Math.abs(one - another) / 8.64e7); | |
} | |
// usage | |
a = daysBetween(new Date(date1), new Date(date2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment