getWeek method

int getWeek(
  1. int monthNum,
  2. int dayNum,
  3. int year
)

It returns the week number of the year.

Args: monthNum (int): The month number (1-12) dayNum (int): The day of the month (1-31) year (int): The year of the date you want to get the week of.

Implementation

int getWeek(int monthNum, int dayNum, int year) {
  double a = (daysPastInYear(monthNum, dayNum, year) / 7) + 1;
  return a.toInt();
}