[Solved] Rounding calendar time to nearest 5 mins [duplicate]
I didn’t test this code but i believe it should work. int unroundedMinutes = isha_jamaat_cal.get(Calendar.MINUTE); int mod = unroundedMinutes % 5; isha_jamaat_cal.add(Calendar.MINUTE, mod < 3 ? -mod : (5-mod)); The basic idea is to check whether the current time is nearest to the next or the previous 5 minutes clock mark and adjusting the added … Read more