getWeeksOfMonth static method

int getWeeksOfMonth(
  1. int year,
  2. int month,
  3. int start
)

获取某年某月有多少周

@param year 年 @param month 月 @param start 星期几作为一周的开始,1234560分别代表星期一至星期天 @return 周数

Implementation

static int getWeeksOfMonth(int year, int month, int start) {
  return ((getDaysOfMonth(year, month) + Solar.fromYmd(year, month, 1).getWeek() - start) * 1.0 / WEEK.length).ceil();
}