const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
const firstDate = new Date(2008, 1, 12);
const secondDate = new Date(2008, 1, 22);
const diffDays = Math.round(Math.abs((firstDate - secondDate) / oneDay));
More Related Contents:
- Set date in input type date
- How to change Gregorian date to Persian date in JavaScript?
- How to display a Date object in a specific format using JavaScript?
- Reloading a single div in an html page [closed]
- Auto Uploading file
- How do you inject this code into HTML using Javascript?
- How to get 100% ADA compliance result in accessibility checker website https://webaccessibility.com? [closed]
- Date is in string format
- fixing slider on my website [closed]
- How to programmatically empty browser cache?
- HTML email with Javascript [closed]
- HTML5 check if audio is playing?
- Prevent form submission with enter key
- Download Canvas as PNG in fabric.js giving network Error
- What events does an fire when its value is changed?
- html5 display audio currentTime
- Javascript: parse a string to Date as LOCAL time zone
- What’s the difference between putting script in head and body?
- How to open specific tab of bootstrap nav tabs on click of a particuler link using jQuery?
- update textarea value, but keep cursor position
- Save canvas as jpg to desktop [duplicate]
- How do you float elements without a vertical gap?
- How can I prevent a click on a ‘#’ link from jumping to top of page?
- Get elements from page.evaluate in Puppeteer? [duplicate]
- How can I delete a window.history state?
- Detecting HTML5 Drag And Drop support in javascript
- Copy/Paste from Excel to a web page
- onclick event function in JavaScript
- Cross-Origin resource sharing and file://
- Content of html page changed by jQuery but “View Source” don’t reflect the changes