- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
You can try to run the following code to learn how to calculate a difference between two dates −
<!DOCTYPE html> <html> <body> <script> var dateFirst = new Date("10/29/2017"); var dateSecond = new Date("10/18/2017"); // time difference var timeDiff = Math.abs(dateSecond.getTime() - dateFirst.getTime()); // days difference var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); // difference alert(diffDays); </script> </body> </html>
- How do I calculate number of days between two dates using Python?
- Find number of days between two given dates in C++
- How to find the number of days and number of weeks between two dates in R?
- How do I generate days from the range of dates in MySQL?
- Python program to find number of days between two given dates
- How can I calculate full 24hour days between two specified dates in MySQL?
- How to count days between two dates in Java
- How to get number of quarters between two dates in Java
- How to get the differences between two dates in iOS?
- How to get the difference between two dates in Android?
- Find the number of logins between two dates in MySQL
- Get the SUM of records between two given dates in MySQL