获取星期几,周一到周日,返回1-7

 public int getDayOfWeek(Date date) {
  Calendar c = Calendar.getInstance();
  c.setTime(date);
  int d = c.get(Calendar.DAY_OF_WEEK) - 1;
  if (d == 0) {
   return 7;
  }
  return d;
 }

posted @ 2016-12-28 17:18  JLCUI  阅读(321)  评论(0编辑  收藏  举报