src/Form/Element/DateTimeTrait.php
protected function normalizeDateTime($value)
    {
        try {
            if (is_int($value)) {
                //timestamp
                $value = new DateTime("@$value");
            } elseif (!$value instanceof DateTime) {
                $value = new DateTime($value);
            }
        } catch (\Exception $e) {
            throw new InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        return $value;
    }
protected function normalizeDateTime($value)
    {
        try {
            if (is_int($value)) {
                //timestamp
                $value = new DateTime("@$value");
            } elseif (!$value instanceof DateTime) {
                $value = new DateTime($value);
            }
        } catch (\Exception $e) {
            throw new InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        return $value;
    }
protected function normalizeDateTime ( $ value ) { try { if ( is_int ( $ value ) ) { //timestamp $ value = new DateTime ( "@$value" ) ; } elseif ( ! $ value instanceof DateTime ) { $ value = new DateTime ( $ value ) ; } } catch ( \ Exception $ e ) { throw new InvalidArgumentException ( 'Invalid date string provided' , $ e -> getCode ( ) , $ e ) ; } return $ value ; }
Normalize the provided value to a DateTime object

@param  string|int|DateTime $value
@throws InvalidArgumentException
@return DateTime
Normalize the provided value to a DateTime object