code: public static function MONTHOFYEAR($dateValue = 1)
      {
          $dateValue = Functions::flattenSingleValue($dateValue);
  
          if (empty($dateValue)) {
              $dateValue = 1;
          }
          if (is_string($dateValue = self::getDateValue($dateValue))) {
              return Functions::VALUE();
          } elseif ($dateValue < 0.0) {
              return Functions::NAN();
          }
  
          // Execute function
          $PHPDateObject = Date::excelToDateTimeObject($dateValue);
  
          return (int) $PHPDateObject->format('n');
      }
docs: MONTHOFYEAR.
  
  Returns the month of a date represented by a serial number.
  The month is given as an integer, ranging from 1 (January) to 12 (December).
  
  Excel Function:
  MONTH(dateValue)
  
  @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
  PHP DateTime object, or a standard date string
  
  @return int Month of the year