java 判断日期是否是周末

来源:互联网 发布:手机域名怎么注册 编辑:程序博客网 时间:2024/06/14 03:49
public static String isWeekend(String bDate) throws ParseException {        DateFormat format1 = new SimpleDateFormat("yyyy/MM/dd");        Date bdate = format1.parse(bDate);        Calendar cal = Calendar.getInstance();        cal.setTime(bdate);        if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){            return "OK";        } else{            return "NO";        } }


0 0
原创粉丝点击