FluidTYPO3\Vhs\ViewHelpers\Format\DateRangeViewHelper::enforceDateTime PHP Method

enforceDateTime() protected method

protected enforceDateTime ( mixed $date ) : DateTime
$date mixed
return DateTime
    protected function enforceDateTime($date)
    {
        if (false === $date instanceof \DateTime) {
            try {
                if (true === is_integer($date)) {
                    $date = new \DateTime('@' . $date);
                } else {
                    $date = new \DateTime($date);
                }
                $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
            } catch (\Exception $exception) {
                throw new Exception('"' . $date . '" could not be parsed by \\DateTime constructor.', 1369573112);
            }
        }
        return $date;
    }