Right now I want to know the difference between two DateTime
For Example
DateTime 1 = 2019-03-02T00:00:00
DateTime 2 = 2019-03-03T00:00:00
How do 1 check that it already past 24 hours or 1 day?
Right now I want to know the difference between two DateTime
For Example
DateTime 1 = 2019-03-02T00:00:00
DateTime 2 = 2019-03-03T00:00:00
How do 1 check that it already past 24 hours or 1 day?
You can simply do so by converting them to both JavaScript Date objects, before finding the difference between the 2 dates.
const date1 = new Date('2019-03-02T00:00:00');
const date2 = new Date('2019-03-03T00:00:00');
console.log(date2 - date1);
const hoursDifference = (date2 - date1) / (1000 * 60 * 60)
console.log(hoursDifference);