All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ze-ph.DateTime.php.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
format(static::DATE_TIME_FORMAT);
        }
        return $result;
    }

    /**
     * @inheritDoc
     */
    public function hydrate($arrayValue, $objectValue, array $array = null)
    {
        $result = null;
        if (!empty($arrayValue)) {
            $date = $this->parseDateString($arrayValue);
            if ($date instanceof \DateTime) {
                $result = $date;
            }
        }
        return $result;
    }

    /**
     * @param $arrayValue
     * @return \DateTime
     */
    protected function parseDateString($arrayValue)
    {
        return \DateTime::createFromFormat(static::DATE_TIME_FORMAT, $arrayValue, new \DateTimeZone('UTC'));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy