src/DateExtension.php
protected function valueToDateTime($date)
    {
        if (!$date instanceof \DateTime) {
            $date = is_int($date) ? \DateTime::createFromFormat('U', $date) : new \DateTime((string)$date);
        }
        
        return $date;
    }
protected function valueToDateTime($date)
    {
        if (!$date instanceof \DateTime) {
            $date = is_int($date) ? \DateTime::createFromFormat('U', $date) : new \DateTime((string)$date);
        }
        
        return $date;
    }
protected function valueToDateTime ( $ date ) { if ( ! $ date instanceof \ DateTime ) { $ date = is_int ( $ date ) ? \ DateTime :: createFromFormat ( 'U' , $ date ) : new \ DateTime ( ( string ) $ date ) ; } return $ date ; }
Turn a value into a DateTime object

@param string|int|\DateTime $date
@return \DateTime
Turn a value into a DateTime object