Calculates the total whole years in the current DateTimeSpan

@return int
554540
protected function getYears()
    {
        $intSecondsPerYear = ($this->isPositive()) ? DateTimeSpan::SECONDS_PER_YEAR : ((-1) * DateTimeSpan::SECONDS_PER_YEAR);
        $intYears = floor($this->intSeconds / $intSecondsPerYear);
        if ($this->isNegative()) {
            $intYears = (-1) * $intYears;
        }
        return $intYears;
    }
24613
public function getAge()
    {
        if (null !== $age = $this->headers->get('Age')) {
            return (int) $age;
        }

        return max(time() - $this->getDate()->format('U'), 0);
    }
1321532
public function getPeriods2()
  {
    $periods = array();

    $this->Period->byOrganizationWithYear($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Period) use (&$periods)
    {
      // array_push($periods, array('value'=> $Period->id, 'label' => $this->Lang->get('decima-accounting::period-management.' . $Period->month) . ' ' . $Period->year->year));
      array_push($periods, array('value'=> $Period->id, 'label' => $this->Lang->get('decima-accounting::period-management.' . $Period->month) . ' ' . $Period->year));
    });

    return $periods;
  }
1288569
public function year_range($start_year = 0, $separator = ' - ')
    {

        if(! is_numeric($start_year)){
            throw new InvalidArgumentException("Invalid Argument Format passed . It should be a number");
        }

        if( $start_year < 0){
            throw new InvalidArgumentException("Invalid Argument passed {$start_year} . It shouldn't be a negative value");
        }

        if( $start_year == 0){
            return $this->current_year();
        }

      return ($start_year == $this->current_year()) ? $this->current_year() : $start_year . $separator . $this->current_year();
    }
767134
public function endOfCentury()
    {
        return $this->endOfYear()->year(
            $this->getYear() - $this->getYear() % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY - 1
        );
    }
209099
public function getPeriodLabel()
	{
		$contexts = $this->contexts; // Protect the contexts
		try
		{
			// If there are only instant context and all the contexts have the same date...
			if ( ! $this->DurationContexts()->count() && count( $this->AllYears() ) == 1 )
			{
				$context = reset( $this->contexts );
				return $context['period']['endDate'];
			}
			else
			{
				$this->sortByStartDate();
				$startContext = reset( $this->contexts );
				$this->sortByEndDate();
				$endContext = end( $this->contexts );
				return "{$startContext['period']['startDate']} - {$endContext['period']['endDate']}";
			}
		}
		finally
		{
			$this->contexts = $contexts; // Restore
		}
	}
1353614
public function isLeapYear($year='') {
        if(empty($year)) {
            $year = $this->year;
        }
        return ((($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0));
    }
320789
private static int getYear(CSLDate date, CSLDateParser dateParser) {
		if (date == null) {
			return -1;
		}
		if (date.getDateParts() == null ||
				date.getDateParts().length == 0 ||
				date.getDateParts()[0] == null ||
				date.getDateParts()[0].length == 0) {
			if (date.getRaw() != null && !date.getRaw().isEmpty()) {
				CSLDate d = dateParser.parse(date.getRaw());
				return getYear(d, dateParser);
			}
			return -1;
		}
		return date.getDateParts()[0][0];
	}
747334
public function getYear()
  {
    if (strlen($this->date) >= 4) {
      $year = substr($this->date, 0, 4);
      $year = str_replace('?', '', $year);

      return ($year ? (int) $year : null);
    }

    return null;
  }
753709
public function getExpiryYear()
    {
        $expiryDate = $this->getDataItem('ExpiryDate');

        if (! empty($expiryDate)) {
            // COnvert 2-digit year to 4-dogot year, in 1970-2069 range.
            $dateTime = \DateTime::createFromFormat('y', substr($expiryDate, 2, 2));
            return (int)$dateTime->format('Y');
        }
    }
885955
public static function schoolYear() {
		static::loadData();
		foreach(static::$arrDBCalendar as $sy) {
			//return graduation year of current school year if available
			if($sy['start'] < time() && $sy['end'] > time()) return date('Y',$sy['end']);
			//else - if a school year is found which begins later than now but already in the current calendar year, return the end year
			//-> summer holidays := following school year
			elseif($sy['start'] > time() && date('Y',$sy['start']) == date('Y')) return date('Y',$sy['end']);
		}
		return false;
	}
1112429
long yearsUntil(InternationalFixedDate end) {
        long startYear = this.prolepticYear * 512L + this.getInternalDayOfYear();
        long endYear = end.prolepticYear * 512L + end.getInternalDayOfYear();
        return (endYear - startYear) / 512L;
    }
475717
def decyear2dt(t):
    
    year = int(t)
    rem = t - year 
    base = datetime(year, 1, 1)
    dt = base + timedelta(seconds=(base.replace(year=base.year+1) - base).total_seconds() * rem)
    #This works for np array input
    #year = t.astype(int)
    #rem = t - year 
    #base = np.array([datetime(y, 1, 1) for y in year])
    return dt
499773
public function getDuration()
    {
        $periods = $this->periods;
        $stopped = \count($periods);
        $left = \count($this->started) - $stopped;

        for ($i = 0; $i < $left; ++$i) {
            $index = $stopped + $i;
            $periods[] = new StopwatchPeriod($this->started[$index], $this->getNow(), $this->morePrecision);
        }

        $total = 0;
        foreach ($periods as $period) {
            $total += $period->getDuration();
        }

        return $total;
    }
1085746
protected function isLeapYear(\DateTime $date)
    {
        $year = (int) $date->format('Y');
        return ((($year % 4) == 0) && ((($year % 100) != 0) || (($year % 400) == 0)));
    }
11000
public function year($value = null)
    {
        if ($value !== null) {
            if ($value < 0 || $value > 9999) {
                $this->year = 0;
            } else {
                $this->year = $value;
            }
        }
        return $this->year;
    }
741557
protected function getYear()
    {
        $arrYear = array();
        $objYear = \Database::getInstance()->prepare("SELECT
                                                        FROM_UNIXTIME(`tstamp`,'%Y')  AS Y
                                                      , COUNT(`id`) AS SUMDL
                                                      FROM `tl_dlstatdets`
                                                      WHERE 1
                                                      GROUP BY Y
                                                      ORDER BY Y DESC")
                                           ->limit(12)
                                           ->execute();
        $intRows = $objYear->numRows;
        if ($intRows>0)
        {
            while ($objYear->next())
            {
                // Y, formatierte Zahl, unformatierte Zahl
                $arrYear[] = array($objYear->Y, $this->getFormattedNumber($objYear->SUMDL,0),$objYear->SUMDL );
            }
        }

        return $arrYear;
    }