code: public static function WEEKNUM($dateValue = 1, $method = 1)
      {
          $dateValue = Functions::flattenSingleValue($dateValue);
          $method = Functions::flattenSingleValue($method);
  
          if (!is_numeric($method)) {
              return Functions::VALUE();
          } elseif (($method < 1) || ($method > 2)) {
              return Functions::NAN();
          }
          $method = floor($method);
  
          if ($dateValue === null) {
              $dateValue = 1;
          } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
              return Functions::VALUE();
          } elseif ($dateValue < 0.0) {
              return Functions::NAN();
          }
  
          // Execute function
          $PHPDateObject = Date::excelToDateTimeObject($dateValue);
          $dayOfYear = $PHPDateObject->format('z');
          $PHPDateObject->modify('-' . $dayOfYear . ' days');
          $firstDayOfFirstWeek = $PHPDateObject->format('w');
          $daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7;
          $interval = $dayOfYear - $daysInFirstWeek;
          $weekOfYear = floor($interval / 7) + 1;
  
          if ($daysInFirstWeek) {
              ++$weekOfYear;
          }
  
          return (int) $weekOfYear;
      }
docs: WEEKNUM.
  
  Returns the week of the year for a specified date.
  The WEEKNUM function considers the week containing January 1 to be the first week of the year.
  However, there is a European standard that defines the first week as the one with the majority
  of days (four or more) falling in the new year. This means that for years in which there are
  three days or less in the first week of January, the WEEKNUM function returns week numbers
  that are incorrect according to the European standard.
  
  Excel Function:
  WEEKNUM(dateValue[,style])
  
  @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
  PHP DateTime object, or a standard date string
  @param int $method Week begins on Sunday or Monday
  1 or omitted    Week begins on Sunday.
  2                Week begins on Monday.
  
  @return int Week Number