In java what is the most effective way to get the time so that you can compare it to another time taken later in the future?
More specifically, how can I get the hours and minutes (separately) of the current time as an integer value (as opposed to a string) to be used to compare later?
Have a look at using the Java
Calendarclass, specifically, the.get(Calendar.HOUR)and.get(Calendar.MINUTE)methods.Don’t store the hour and minute values though, either store an instance of the
Calendarclass, or store the current UNIX timestamp, and compare those, obtaining the hours and minutes after performing the subtraction.