Doctrine\ODM\OrientDB\Caster\Caster::castDate PHP Method

castDate() public method

If the value was stored as a timestamp, it sets the value to the DateTime object via the setTimestamp method.
public castDate ( ) : DateTime
return DateTime
    public function castDate()
    {
        $dateClass = $this->getDateClass();
        $value = preg_replace('/(\\s\\d{2}:\\d{2}:\\d{2}):(\\d{1,6})/', '$1.$2', $this->value);
        if (is_numeric($value)) {
            $datetime = new $dateClass();
            $datetime->setTimestamp($value);
        } else {
            $datetime = new $dateClass($value);
        }
        return $datetime;
    }