class SpringRedisApplicationTests {
private Timestamp timestamp;
@Test
public void contextLoads() throws ParseException {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Date start = sdf.parse(sdf.format(timestamp));
Date end1 = sdf.parse("19:00:00");
int a=0;
int b=1;
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
public static void main(String args[]) throws ParseException {
String str = "2018-05-06 13:00:40";
Timestamp timestamp = Timestamp.valueOf(str);
System.out.println(commonStatus(timestamp));
}
public static int commonStatus(Timestamp timestamp) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Date start = sdf.parse(sdf.format(timestamp));
if ((start.after(sdf.parse("06:30:00")) && start.before(sdf.parse("07:00:01")))
|| ((start.after(sdf.parse("12:30:00")) && start.before(sdf.parse("13:00:01"))))) {
return 1;
} else if ((start.after(sdf.parse("07:00:00")) && start.before(sdf.parse("07:30:01")))
|| ((start.after(sdf.parse("13:00:00")) && start.before(sdf.parse("13:30:01"))))) {
return 2;
} else {
return 3;
}
}
}
timeStamp判断早退迟到
最新推荐文章于 2022-01-21 11:36:51 发布