I am working on a date comparison and I am trying to calculate and display the difference between two dates in a format of dates, hours, minutes... Date values are stored in the DB like:
EndDate : 2018-11-29 10:49:49.9396033
PurchaseDate: 2018-11-29 10:49:07.4154497
And in my Angular component, I have:
let result = new Date(res.endDate).valueOf() - new Date(res.purchaseDate).valueOf();
This leads to: 42524
which I am not sure what it represents.
I wonder what is the proper way to calculate the time difference between two dates and also how can I display the result in a proper and readable way.
Any help is welcome