24 hours and 1 day are not the same thing. But both of you use Calendar:
Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.DATE, -1); Date d = c.getTime();
If you return for 24 hours, you should use Calendar.HOUR_OF_DAY
Dilum rananunga
source share