Referencia: https://blog.csdn.net/lihua5419/article/details/80625114
Hora actual: 15:00, juzgue si es entre las 3:00 y las 16:00
import java.util.Date; import java.text.SimpleDateFormat; public class date3 { public static void main (String [] args) { SimpleDateFormat dateFormater = new SimpleDateFormat ("HHmm" ); String date = dateFormater.format ( new Date ()); System.out.println (fecha); int time = Integer.parseInt (fecha); if (tiempo> 300 && tiempo <1600 ) { System.out.println ( "在 时间段内" ); } más { System.out.println ( "No dentro de este período de tiempo" ); } } }