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).
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);