今天接到一个需求,执行时需要排除周六周日,随手写了一个calendar被我师傅喷了.
发扬好记性不如烂笔头精神(防止以后继续被喷),记下来以防忘记;
LocalDateTime now = LocalDateTime.now();
DayOfWeek dayOfWeek = now.getDayOfWeek();
if(dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY){
logger.info("周末放假咯");
}else {
logger.info("上班咯");
}