public String timeToV2() {
Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);//获取当前时间(小时)
int minute = cal.get(Calendar.MINUTE); //获取当前时间(分钟)
int secondOfDay = (hour * 60 + minute) * 60;
final int start1 = 7 * 60 * 60;
final int end1 = 9 * 60 * 60;
final int start2 = 12 * 60 * 60;
final int end2 = 14 * 60 * 60;
final int start3 = 18 * 60 * 60;
final int end3 = 21 * 60 * 60;
if ((secondOfDay >= start1 && secondOfDay <= end1)||(secondOfDay >= start2 && secondOfDay <= end2)||(secondOfDay >= start3 && secondOfDay <= end3)) {
return "在规定时间范围内";
}
return "不在规定时间范围内";
}