Calendar tempTime = Calendar.getInstance();
//Régler le temps
tempTime.set(Calendar.HOUR_OF_DAY, trainHour);
tempTime.set(Calendar.MINUTE, trainTime);
boolean isBefore = false;
//Indique si tempTime est avant safeTime
isBefore = tempTime.before(safeTime);
import java.text.SimpleDateFormat;
---------------------------------------
//Créer une instance de la classe de calendrier
Calendar ansTime = Calendar.getInstance();
Date time = ansTime.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
System.out.println(sdf.format(time));
Recommended Posts