java判断当前时间是否在两个时间段内

SimpleDateFormat dateFormater = new SimpleDateFormat("HHmm");
	String date= dateFormater.format(new Date());
	System.out.println(date);
	int time = Integer.parseInt(date);
	if(time>1600&&time<1700){
		System.out.println("在时间段内");
	}else{
		System.out.println("不在这个时间段内");
	}

猜你喜欢

转载自blog.csdn.net/lihua5419/article/details/80625114