Get year.

@param string $format The one of self::YEAR_FORMAT_* constants

@return int
334398
public function getYear($format = self::YEAR_FORMAT_LONG)
    {
        if ($this->isHollow()) {
            return 0;
        }

        return (int) $this->format($format);
    }
343550
public function format($format)
    {
        $parsedFormat = static::parseFormat($format);

        if (is_null($parsedFormat)) {
            throw NumberFormatException::invalid($format);
        }

        return $this->lib->format(
            $this->getPhoneNumberInstance(),
            $parsedFormat
        );
    }
996501
public function format(int $format) : string
    {
        return PhoneNumberUtil::getInstance()->format($this->phoneNumber, $format);
    }
804358
public function getRequestDate($format = null)
    {
        $node = $this->getFirst('//epp:epp/epp:response/epp:resData/domain:trnData/domain:reDate');
        if ($format === null) {
            return $node->nodeValue;
        }

        return date_create_from_format($format, $node->nodeValue);
    }
76974
public function getMetaDateFormatted($format = null)
    {
        if ($this->owner->hasMetaDate()) {
            return $this->owner->getMetaDate()->Format($format ? $format : $this->owner->getMetaDateFormat());
        }
    }
1117402
public function setYear($year)
    {
        if (!is_scalar($year)) {
            throw new Exception('Year must be a string or an integer in EventManager setYear method.');
        }
        $this->year = $year;

        return $this->year;
    }
534309
public function getDate($format = null)
    {
        $format = empty($format) ? $this->format : $format;

        return strftime($format, $this->ts);
    }
292055
protected function getFormat($format)
    {
        if ($format === false) {
            $format = 'none';
        }
        
        $types = [
            'none' => \IntlDateFormatter::NONE,
            'short' => \IntlDateFormatter::SHORT,
            'medium' => \IntlDateFormatter::MEDIUM,
            'long' => \IntlDateFormatter::LONG,
            'full' => \IntlDateFormatter::FULL
        ];
        
        return isset($types[$format]) ? $types[$format] : null;
    }
1308292
public function getCreatedAt($format = 'Y-m-d H:i:s')
    {
        if ($this->createdAt instanceof \DateTime && $format !== null) {
            return $this->createdAt->format($format);
        }

        return $this->createdAt;
    }
1285436
public function getBoletoExpirationDate($format = 'Y-m-d\TH:i:s')
    {
        $value = $this->getParameter('boleto_expiration_date');
        
        return $value ? $value->format($format) : null;
    }
696438
public function get($format)
    {
        switch ($format) {
            case 'json':
                return $this->toJson();
                break;
            case 'serialize':
                return $this->serialize();
                break;
            case 'array':
                return $this->toArray();
                break;
            case 'xml':
                return $this->toXml();
                break;
            default:
                return $this;
        }
    }
592649
public function format($format)
    {
        $timestamp = mktime(
            $this->hour,
            $this->minute,
            $this->second,
            $this->month,
            $this->day,
            $this->year
        );
        return strftime($format, $timestamp);
    }
523569
public int getEraYear(final Calendar cal) {
        ArgUtils.notNull(cal, "cal");
        
        final Calendar startCal = Calendar.getInstance(TimeZone.getTimeZone("GMT-00:00"));
        startCal.setTime(startDate);
        
        final int diff = cal.get(Calendar.YEAR) - startCal.get(Calendar.YEAR) + 1;
        return diff;
        
    }
177096
public function getFormattedImage($format)
    {
        $formatName = $format instanceof FormatInterface
            ? $format->getName()
            : $format
        ;

        return $this->formattedImages
            ->filter(function (FormattedImageInterface $formattedImage) use ($formatName) {
                return ($format = $formattedImage->getFormat())
                    && $format->getName() == $formatName
                ;
            })
            ->first() ?: null // first() returns "false" if collection empty
        ;
    }
274423
public function getValidUntil($format = 'Y-m-d')
    {
        if ($this->validUntil instanceof \DateTime && $format !== null) {
            return $this->validUntil->format($format);
        }

        return $this->validUntil;
    }
1273811
public function format($format = null) {
        if(is_null($format)) {
            $format = $this->getFormatter()->getCurrentFormat();
        }
        return date($format, $this->getEpoch());
    }
543014
public static function fromYear(int $year): string
    {
        // note this checks SeasonYearParam::FORMAT (YYYY), not self::FORMAT
        if (preg_match(SeasonYearParam::FORMAT, (string) $year) !== 1) {
            throw new \InvalidArgumentException('Year must be an integer in YYYY format');
        }

        return $year.'-'.substr((string) ($year + 1), -2);
    }