Get a log or fail

@param  string  $date

@return Log|null
331439
private function getLogOrFail($date)
    {
        try {
            return app(LogViewer::class)->get($date);
        } catch (LogNotFound $e) {
            return abort(404, $e->getMessage());
        }
    }
818137
public function getUserDate($date)
    {
        $date = DBDatetime::create()->setValue($date);
        $member = Security::getCurrentUser();
        return $date->FormatFromSettings($member);
    }
768347
private function getLogOrFail($date)
    {
        try {
            return $this->viewer->get($date);
        } catch (Exception $e) {
            return abort(404, $e->getMessage());
        }
    }
618717
public static function parseDateMDY(?string $date): ?\DateTimeImmutable
    {
        if ($date === '-' || $date === null) {
            return null;
        }

        $dateArray = explode('-', $date);

        if ($dateArray[0] === '??' && $dateArray[1] === '??' && $dateArray[2] === date('y')) {
            return null;
        }

        $date = str_replace('??', '01', $date);

        return \DateTimeImmutable::createFromFormat('!m-d-y', $date, new \DateTimeZone('UTC')) ?: null;
    }
1181067
public function date($date)
    {
        $events = $this->repository->findEventsByDate($date);

        if (empty($events)) {
            abort(404);
        }

        return view('cms-frontend::events.date')->with('events', $events);
    }
971102
protected function getFormatedDate($date)
    {
        if (! is_null($date)) {
            if (! ($date instanceof Carbon)) {
                $date = Carbon::parse($date);
            }

            $date = $date->timezone($this->getTimezone())->format($this->getFormat());
        }

        return $date;
    }
84156
public function parse($date) {
        if (is_string($date)) {
            if (($date == "") || strtotime($date) == -1) {
                //为空默认取得当前时间戳
                $tmpdate = time();
            } else {
                //把字符串转换成UNIX时间戳
                $tmpdate = strtotime($date);
            }
        } elseif (is_null($date))  {
            //为空默认取得当前时间戳
            $tmpdate = time();

        } elseif (is_numeric($date)) {
            //数字格式直接转换为时间戳
            $tmpdate = $date;

        } else {
            if (get_class($date) == "Date") {
                //如果是Date对象
                $tmpdate = $date->date;
            } else {
                //默认取当前时间戳
                $tmpdate = time();
            }
        }
        return $tmpdate;
    }
541618
public function getPeriod($date)
    {
        $resultPeriod = null;

        for ($i = count($this->periods) - 1; $i >= 0; $i--) {
            $period = $this->periods[$i];

            if ($period->getEffectiveFrom() <= $date) {
                $resultPeriod = $period;
            }
        }

        return $resultPeriod;
    }
380021
public function date($date)
    {
        if (! $date instanceof DateTime) {
            $date = new DateTime($date);
        }

        $this->executionYear = $date->format('Y');

        return $this->at("{$date->format('i')} {$date->format('H')} {$date->format('d')} {$date->format('m')} *");
    }
748707
public static function getFormattedDate($date, $format)
    {
        if (StringUtils::isEmpty($date) || StringUtils::isEmpty($format)) {
            return null;
        }

        return date($format, strtotime($date));
    }
185466
protected static function parseDate(
        string $date,
        string $format = null,
        string $output = null
    ) {
        $d = \DateTime::createFromFormat($format ?? static::DATE_FORMAT, $date);
        return ($d ? $d->format($output ?? 'Y-m-d') : null);
    }
1169297
public function date($date=null)
    {
        if(is_null($date)) {
            $date = $this->created_at;
        }
        return String::date($date);
    }
486003
public function get($date, $default = null)
    {
        if (!$this->has($date)) {
            return false;
        }
        return parent::get($date, $default);
    }
1095704
public function date($date, $format = null)
	{
		$datetime = DateTimeUtil::getDateTime($date);
        if (empty($format)) {
			$format = $this->cfg['date_format'];
		}
		if ($format == 'rel') {
			$date = DateTimeUtil::getRelTime($datetime);
		} else {
			$date = $datetime->format($format);
		}
		return $date;
	}
212389
private function isValidDate($date)
    {
        $date = str_replace('/', '-', $date);

        return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null;
    }
299720
private function getTimeDrift(string $date) :? int
    {
        $now = new \DateTime();
        $now->format(\DateTime::RFC1123);

        try {
            $realDate = new DateTime($date);
        } catch (\Exception $e) {
            return null;
        }

        return (int)\abs($now->getTimestamp() - $realDate->getTimestamp());
    }
404443
public function read($date)
    {
        try {
            $log = $this->filesystem->get(
                $this->getLogPath($date)
            );
        }
        catch (\Exception $e) {
            throw new FilesystemException($e->getMessage());
        }

        return $log;
    }