Returns 24-hour time and the day using the grammatical tense
of the current time. Eg: Today at 12:49, Yesterday at 4:00
or 18 Sep 2015 at 14:33.

@return string
550010
public static function timeTense($datetime)
    {
        $datetime = self::makeCarbon($datetime);
        $yesterday = $datetime->subDays(1);
        $tomorrow = $datetime->addDays(1);
        $time = $datetime->format('H:i');
        $date = $datetime->format('j M Y');

        if ($datetime->isToday()) {
            $date = 'Today';
        }
        elseif ($datetime->isYesterday()) {
            $date = 'Yesterday';
        }
        elseif ($datetime->isTomorrow()) {
            $date = 'Tomorrow';
        }

        return $date.' at '.$time;
    }
898135
public function getStartDate() {
        $now = $this->getNow();
        $endOfDay = $this->getToday()->modify('+18 hours');

        $currentDay = $this->getToday();

        if($now > $endOfDay) {
            $currentDay->modify('+1 day');
        }

        return $currentDay;
    }
698786
public function toMinutes()
        {
            $time = $this->get();
            if (!$time) {
                $time = '00:00';
            } else {
                $time = sprintf('%02d:%02d', (int)(floor($time / 60)), (int)($time % 60));
            }
            return $this;
        }
241993
public static function now()
    {
        $date = new DateTime();
        if (self::$freeze) {
            $date->setTimestamp(self::$freezeDate->getTimestamp());
            $date->setTimezone(self::$freezeDate->getTimezone());
        }
        return new Clock($date);
    }
739476
public function getRemainingSuspensionTime()
	{
		if(!$this->isSuspended())
			return 0;

		$lastAttempt = clone $this->last_attempt_at;

		$suspensionTime  = static::$suspensionTime;
		$clearAttemptsAt = $lastAttempt->modify("+{$suspensionTime} minutes");
		$now             = new Datetime;

		$timeLeft = $clearAttemptsAt->diff($now);

		$minutesLeft = ($timeLeft->s != 0 ?
						($timeLeft->days * 24 * 60) + ($timeLeft->h * 60) + ($timeLeft->i) + 1 :
						($timeLeft->days * 24 * 60) + ($timeLeft->h * 60) + ($timeLeft->i));

		return $minutesLeft;
	}
726183
public function getTime()
    {
        // Time should only be used with the history state.
        if (!$this->isHistory()) {
            return new DateTime('now');
        }

        $timestamp = $this->session->get($this->timePersistenceKey, time());

        return (new DateTime())->setTimestamp($timestamp);
    }
436041
public function getDateActive() : ?DateTime
     {
        $rtn = $this->data['date_active'];

        if (!empty($rtn)) {
            $rtn = new DateTime($rtn);
        }

        return $rtn;
     }
1013512
public function getTime()
    {
        $time = 0;
        foreach ($this->data['queries'] as $query) {
            if (array_key_exists('took', $query['response'])) {
                $time += $query['response']['took'];
            }
        }

        return $time;
    }
622530
static function Today()
     {
         $now = new Date();
         return new Date($now->Day(), $now->Month(), $now->Year(), 0, 0, 0);
     }
865292
public function getTime()
    {
        $time = new \DateTime($this->data['transaction_date'], new \DateTimeZone('EST'));
        $time->setTimezone(new \DateTimeZone('UTC'));

        return $time->format('c');
    }
1125030
public function getDuration()
    {
        if ($this->duration === null) {
            $match = [];
            preg_match(self::$REGEX_DURATION, $this->output, $match);
            if (array_key_exists(1, $match) && array_key_exists(2, $match) && array_key_exists(3, $match)) {
                $hours = (int)$match[1];
                $minutes = (int)$match[2];
                $seconds = (int)$match[3];
                $fractions = (float)(array_key_exists(5, $match) ? '0.'.$match[5] : 0.0);

                $this->duration = (($hours * 3600) + ($minutes * 60) + $seconds + $fractions);
            } else {
                $this->duration = 0.0;
            }

            return $this->duration;
        }

        return $this->duration;
    }
487140
public static function ts()
    {
        static $time = null;

        if(null !== $time) {
            return $time;
        }

        $time = isset($_SERVER['REQUEST_TIME'])
            ? $_SERVER['REQUEST_TIME']
            : time();

        return $time;
    }
369461
public function day(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i'): string
	{
		if($dateTime->format('Y-m-d') === date('Y-m-d'))
		{
			return $this->i18n->get('humanizer.today');
		}
		elseif($dateTime->format('Y-m-d') === date('Y-m-d', time() - (60 * 60 * 24)))
		{
			return $this->i18n->get('humanizer.yesterday');
		}
		elseif($dateTime->format('Y-m-d') === date('Y-m-d', time() + (60 * 60 * 24)))
		{
			return $this->i18n->get('humanizer.tomorrow');
		}
		else
		{
			return $dateTime->format($dateFormat);
		}
	}
411756
public function humanize($period = 'second')
    {
        $translator = $this->getObject('translator');

        $periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year');
        $lengths = array(60, 60, 24, 7, 4.35, 12, 10);
        $now     = new DateTime();

        if($now != $this->_date)
        {
            if($now->getTimestamp() > $this->getTimestamp())
            {
                $difference = $now->format('U') - $this->getTimestamp();
                $tense      = 'ago';
            }
            else
            {
                $difference = $now->format('U') - $this->getTimestamp();
                $tense      = 'from now';
            }

            for($i = 0; $difference >= $lengths[$i] && $i < 6; $i++) {
                $difference /= $lengths[$i];
            }

            $difference      = round($difference);
            $period_index    = array_search($period, $periods);
            $omitted_periods = $periods;
            array_splice($omitted_periods, $period_index);

            if(in_array($periods[$i], $omitted_periods))
            {
                $difference = 1;
                $i          = $period_index;
            }

            if($periods[$i] == 'day' && $difference == 1)
            {
                // Since we got 1 by rounding it down and if it's less than 24 hours it would say x hours ago, this
                // is yesterday
                return $tense == 'ago' ? $translator->translate('Yesterday') : $translator->translate('Tomorrow');
            }

            $period        = $periods[$i];
            $period_plural = $period . 's';

            // We do not pass $period or $tense as parameters to replace because some languages use different words
            // for them based on the time difference.
            $result = $translator->choose(
                                 array("{number} $period $tense", "{number} $period_plural $tense"),
                                     $difference,
                                     array('number' => $difference)
            );
        }
        else $result = $translator->translate('Just now');

        return $result;
    }
624982
public function getExpiresInterval()
    {
        if (!$this->expiresAt) return '';
        $now = new \DateTime();
        $interval = $now->diff($this->expiresAt);
        if ($interval->days == 1)
            return $interval->format('%a jour');
        elseif ($interval->days > 1)
            return $interval->format('%a jours');
        elseif ($interval->h == 1)
            return $interval->format('%h heure');
        else
            return $interval->format('%h heures');
    }
978720
function DaysToNow(){ // as datetime object returns difference in seconds
		if(empty(self::$dtnow)){
			self::$dtnow=new \DateTime();
			}
		//Get difference
		$diff=$this->diff(self::$dtnow);
		$diff_days =$diff->format('%r').($diff->days);
		return $diff_days;
		}
170144
public function getTimestamp()
    {
        if (!isset($this->data['ts'])) {
            return null;
        }

        $time = new \DateTime();
        $time->setTimestamp($this->data['ts']);
        return $time;
    }