Hi Guys i have two date firstDate = "06/11/2019" lastDate = "15/11/2019 00:00:00"
var date1 = new Date(firstDate);
var date2 = new Date(lastDate);
var diffTime = Math.abs(date2 - date1);
var diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
i get diffDays=NaN. how can i do this. Thanks.
Your lastDate is an invalid date. You can check this with
Date.parse("15/11/2019 00:00:00")
which will return a NaN
Check the Warnings section https://www.w3schools.com/js/js_date_formats.asp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.