Could anyone please help me out for calculating Date
difference in terms of no of days in an efficient way?
Date nextCollectionDate = dispenseNormal.getDispensing().getNextCollectionDate();
Date currentDate = new Date();
int daysDiff = currentDate - nextCollectionDate;
//diff in msec
long diff = currentDate.getTime() - nextCollectionDate.getTime();
//diff in days
long days = diff / (24 * 60 * 60 * 1000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With