I’m trying to convert the difference of two dates to days, in decimal notation, for example, at the moment I am doing this,
Date mostRecentDate = dates[0];
Date previousDate = dates[1];
long mostRecentTime = mostRecentDate.getTime();
long previousTime = previousDate.getTime();
long diffInDays = (mostRecentTime - previousTime ) / (1000 * 60 * 60 * 24);
This will always result in the whole amount of days, but I was hoping if the difference in two dates was two and a half days, I could return 2.5 or if the difference was 6 hours I could return 0.25 etc.
Thanks !
DataType is the matter . You can use Double.