jeudi 31 octobre 2019

Compare hours and minutes using only if

I got two variables, hour and minute. I need compare it with another h/m and depending results, show it or not. Example: 13:30 needs to print "AHORA TOCA". But only if this time is previous to 20:30. Is earlier by the hour but not by the minute.

int hours = 13;
int minutes = 30;
if(hours <= 20){
            if(minutes < 30){
                System.out.println("AHORA TOCA");     
            } 
        }

This don't print cause minutes. So, what can i do?

Aucun commentaire:

Enregistrer un commentaire