public function convert($input)
    {
        if (!$input) {
            return;
        }

        if (!($input instanceof \DateTime)) {
            throw new UnexpectedValueException('Input must be DateTime object.');
        }

        return $input->format($this->outputFormat);
    }
public function convert($input)
    {
        if (!$input) {
            return;
        }

        if (!($input instanceof \DateTime)) {
            throw new UnexpectedValueException('Input must be DateTime object.');
        }

        return $input->format($this->outputFormat);
    }
public function convert ( $ input ) { if ( ! $ input ) { return ; } if ( ! ( $ input instanceof \ DateTime ) ) { throw new UnexpectedValueException ( 'Input must be DateTime object.' ) ; } return $ input -> format ( $ this -> outputFormat ) ; }
Convert string to date time object
using specified format

@param mixed $input
@return \DateTime|string
@throws UnexpectedValueException
Convert string to date time object using specified format