private function createDateFromText($text)
    {
        try {
            $date = new \DateTime($text);
        } catch (\Exception $e) {
            $date = new \DateTime(self::DEFAULT_TO_DATE);
        }

        return $date->format('Y-m-d');
    }
private function createDateFromText($text)
    {
        try {
            $date = new \DateTime($text);
        } catch (\Exception $e) {
            $date = new \DateTime(self::DEFAULT_TO_DATE);
        }

        return $date->format('Y-m-d');
    }
private function createDateFromText ( $ text ) { try { $ date = new \ DateTime ( $ text ) ; } catch ( \ Exception $ e ) { $ date = new \ DateTime ( self :: DEFAULT_TO_DATE ) ; } return $ date -> format ( 'Y-m-d' ) ; }
Convert a DateTime compatible date or expression into an ES compatible date format

@param string $text Date as text.

@return string
Convert a DateTime compatible date or expression into an ES compatible date format