根据输入的日期 获得当前日期为周几

来源:互联网 发布:h5微社区源码 编辑:程序博客网 时间:2024/05/21 08:42
public static String getWeekOfDate(Date dt) {        String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};        Calendar cal = Calendar.getInstance();        cal.setTime(dt);        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;        if (w < 0)            w = 0;        return weekDays[w];    }
原创粉丝点击