Get the difference in minutes.

@param Carbon|\DateTimeInterface|string|null $date
@param bool                                  $absolute Get the absolute of the difference

@return int
975862
public function diffInMinutes($date = null, $absolute = true)
    {
        return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE);
    }
705380
public function getDifferenceInDays($compare = null)
        {
            if (!$compare) {
                $compare = new Date(null, $this->getTimezone());
            }

            return $this->diff($compare)->format('%r%a');
        }
265686
public function floatDiffInMonths($date = null, $absolute = true)
    {
        $start = $this;
        $end = $this->resolveCarbon($date);
        $ascending = ($start <= $end);
        $sign = $absolute || $ascending ? 1 : -1;
        if (!$ascending) {
            $_end = $start;
            $start = $end;
            $end = $_end;
            unset($_end);
        }
        $monthsDiff = $start->diffInMonths($end);
        /** @var Carbon|CarbonImmutable $floorEnd */
        $floorEnd = $start->copy()->addMonths($monthsDiff);

        if ($floorEnd >= $end) {
            return $sign * $monthsDiff;
        }

        /** @var Carbon|CarbonImmutable $startOfMonthAfterFloorEnd */
        $startOfMonthAfterFloorEnd = $floorEnd->copy()->addMonth()->startOfMonth();

        if ($startOfMonthAfterFloorEnd > $end) {
            return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($end) / $floorEnd->daysInMonth);
        }

        return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($startOfMonthAfterFloorEnd) / $floorEnd->daysInMonth + $startOfMonthAfterFloorEnd->floatDiffInDays($end) / $end->daysInMonth);
    }
286903
public function floatDiffInYears($date = null, $absolute = true)
    {
        $start = $this;
        $end = $this->resolveCarbon($date);
        $ascending = ($start <= $end);
        $sign = $absolute || $ascending ? 1 : -1;
        if (!$ascending) {
            $_end = $start;
            $start = $end;
            $end = $_end;
            unset($_end);
        }
        $yearsDiff = $start->diffInYears($end);
        /** @var Carbon|CarbonImmutable $floorEnd */
        $floorEnd = $start->copy()->addYears($yearsDiff);

        if ($floorEnd >= $end) {
            return $sign * $yearsDiff;
        }

        /** @var Carbon|CarbonImmutable $startOfYearAfterFloorEnd */
        $startOfYearAfterFloorEnd = $floorEnd->copy()->addYear()->startOfYear();

        if ($startOfYearAfterFloorEnd > $end) {
            return $sign * ($yearsDiff + $floorEnd->floatDiffInDays($end) / $floorEnd->daysInYear);
        }

        return $sign * ($yearsDiff + $floorEnd->floatDiffInDays($startOfYearAfterFloorEnd) / $floorEnd->daysInYear + $startOfYearAfterFloorEnd->floatDiffInDays($end) / $end->daysInYear);
    }
99429
public function diffInHours(Time $dt = null, $abs = true)
        {
            return (int) ($this->diffInSeconds($dt, $abs) / self::SECONDS_PER_MINUTE / self::MINUTES_PER_HOUR);
        }
76456
public static function compareDateIntervals(DateInterval $a, DateInterval $b)
    {
        $current = Carbon::now();
        $passed = $current->copy()->add($b);
        $current->add($a);

        if ($current < $passed) {
            return -1;
        } elseif ($current > $passed) {
            return 1;
        }

        return 0;
    }
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
1361946
public function diff(DateTime $datetime, $absolute = false)
	{
		return new DateInterval($this->datetime->diff($datetime->datetime, $absolute));
	}
1199424
public function diffInMinutes(Date $dt = null, $abs = true)
    {
        return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE);
    }
1091377
private function dateDiff() : DateInterval
    {
        if (null === $this->dateDiff) {
            $this->dateDiff = $this->from->withTimeAtMidnight()->diff($this->until->withTimeAtMidnight());
        }
        
        return $this->dateDiff;
    }
644937
public function diff(Time $time, $absolute = true)
    {
        $diff = $this->getSeconds() - $time->getSeconds();

        return new self(0, 0, $absolute ? abs($diff) : $diff);
    }
302984
public function timeAgo($date)
    {
        $interval = $this->getInterval(time(), $date);
        if ($interval->invert) {
            return $this->convert(time(), $date);
        }

        return $this->translation->translate();
    }
1033198
public static function inPast($date, $time = null)
    {
        if (is_null($time)) {
            $time = self::time();
        }
        if (!is_int($date)) {
            $date = self::strtotime($date);
        }

        return $time > $date;
    }
250190
public static function compare($date1, $date2, $operator = null)
    {
        $date1 = $date1 instanceof \DateTimeInterface ? $date1 : new \DateTime($date1);
        $date2 = $date2 instanceof \DateTimeInterface ? $date2 : new \DateTime($date2);

        if ($operator === null) {
            if ($date1 == $date2) {
                return 0;
            }

            return (int) ($date1 < $date2);
        }

        switch ((string) $operator) {
            case '=':
                return $date1 == $date2;
            case '!=':
                return $date1 != $date2;
            case '>':
            case 'gt':
                return $date1 > $date2;
            case '>=':
            case 'gte':
                return $date1 >= $date2;
            case '<':
            case 'lt':
                return $date1 < $date2;
            case '<=':
            case 'lte':
                return $date1 <= $date2;
        }

        throw new \InvalidArgumentException('Invalid operator: ' . $operator);
    }
1211803
public static function Diff($in = false, $out = false)
        {

            // Setting the IN timestamp
            if (is_int($in)):
                $inTime = $in; else:
                $inTime = strtotime($in);
            endif;

            // Setting the OUT timestamp
            if (is_int($out)):
                $outTime = $out; else:
                $outTime = strtotime($out);
            endif;

            // Setting the DATE for $inTime and $outTime
            $inDT = date("Y-m-d H:i:s", $inTime);
            $outDT = date("Y-m-d H:i:s", $outTime);

            // Creating the IN and OUT objects
            $inObj = new \DateTime($inDT);
            $outObj = new \DateTime($outDT);

            // Calculating the difference between dates
            $output = $inObj->diff($outObj);

            // Returning the difference
            return $output;
        }
625133
public function diffInRealSeconds($date = null, $absolute = true)
    {
        /** @var CarbonInterface $date */
        $date = $this->resolveCarbon($date);
        $value = $date->getTimestamp() - $this->getTimestamp();

        return $absolute ? abs($value) : $value;
    }
226537
public static function datediff($date1, $date2) {
		ref\sanitize::date($date1);
		ref\sanitize::date($date2);

		// Same or bad dates.
		if (
			! \is_string($date1) ||
			! \is_string($date2) ||
			($date1 === $date2) ||
			('0000-00-00' === $date1) ||
			('0000-00-00' === $date2)
		) {
			return 0;
		}

		// Prefer DateTime.
		if (\class_exists('DateTime')) {
			$date1 = new \DateTime($date1);
			$date2 = new \DateTime($date2);
			$diff = $date1->diff($date2);

			return \abs($diff->days);
		}

		// Fallback to counting seconds.
		$date1 = \strtotime($date1);
		$date2 = \strtotime($date2);
		return \ceil(\abs($date2 - $date1) / 60 / 60 / 24);
	}