public function convert($date)
    {

        // create a DateTime instance from the passed value
        if ($dateTime = \DateTime::createFromFormat($this->getDateConverterConfiguration()->getSourceDateFormat(), $date)) {
            return $dateTime->format('Y-m-d H:i:s');
        }

        // return NULL, if the passed value is NOT a valid date
        return null;
    }
public function convert($date)
    {

        // create a DateTime instance from the passed value
        if ($dateTime = \DateTime::createFromFormat($this->getDateConverterConfiguration()->getSourceDateFormat(), $date)) {
            return $dateTime->format('Y-m-d H:i:s');
        }

        // return NULL, if the passed value is NOT a valid date
        return null;
    }
public function convert ( $ date ) { // create a DateTime instance from the passed value if ( $ dateTime = \ DateTime :: createFromFormat ( $ this -> getDateConverterConfiguration ( ) -> getSourceDateFormat ( ) , $ date ) ) { return $ dateTime -> format ( 'Y-m-d H:i:s' ) ; } // return NULL, if the passed value is NOT a valid date return null ; }
Converts the passed date into a Magento 2 compatible date format.

@param string $date The date to convert

@return string The converted date
Converts the passed date into a Magento 2 compatible date format .