Created
September 18, 2017 08:53
-
-
Save SuperAL/12082d138a6375bf7488a3548a686992 to your computer and use it in GitHub Desktop.
获取时间区间的跨度天数
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
| // stackoverflow: https://stackoverflow.com/a/2627493/6339408 | |
| var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds | |
| var firstDate = new Date(2008,01,12); | |
| var secondDate = new Date(2008,01,22); | |
| var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay))); // -> 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment