How do you get the total number of minutes in the day so far in Java (Android)? Is this possible? For example, if it was 12:37am, I would want it to return int 37 (37 minutes so far that day). Or if it was 1:41am, I would want it to return int 101 (101 minutes so far that day), or if it 12:20pm, it would return int 740 (740 total minutes that day).
A day is equal to 1440 minutes.
That is, there are 1440 minutes in a day.
Answer and Explanation: The answer is 1.39%.
I actually used the Calendar class to figure this out.
Here is the code, with currentMinuteOfDay
being the total number of minutes.
Calendar now = Calendar.getInstance();
int hour = now.get(Calendar.HOUR_OF_DAY);
int minute = now.get(Calendar.MINUTE);
int currentMinuteOfDay = ((hour * 60) + minute);
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