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

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

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 bool|\DateTime
     */
    protected function parseDateString($arrayValue)
    {
        return \DateTime::createFromFormat(static::DATE_TIME_FORMAT, $arrayValue, new \DateTimeZone('UTC'));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy