Skip to content

Commit

Permalink
Fix daysBetween
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoobergs committed Sep 9, 2017
1 parent bfad504 commit 0dea50e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ public static boolean isSameDayAndHour(Calendar dateOne, Calendar dateTwo) {
* @return the amount of days between dateTwo and dateOne
*/
public static int daysBetween(Calendar dateOne, Calendar dateTwo) {
return (int) (
(dateTwo.getTimeInMillis() + dateTwo.getTimeZone().getOffset(dateTwo.getTimeInMillis()) -
(dateOne.getTimeInMillis() + dateOne.getTimeZone().getOffset(dateOne.getTimeInMillis())))
/ (1000 * 60 * 60 * 24f));
return (int) (((dateTwo.getTimeInMillis() + dateTwo.getTimeZone().getOffset(dateTwo.getTimeInMillis())) / (1000 * 60 * 60 * 24)) -
((dateOne.getTimeInMillis() + dateOne.getTimeZone().getOffset(dateOne.getTimeInMillis())) / (1000 * 60 * 60 * 24)));
}

/*
Expand Down

0 comments on commit 0dea50e

Please sign in to comment.