protected function convert_string( $value ) {

		$format = $this->input_data[ 'format' ];
		$date   = \DateTime::createFromFormat( $format, $value );

		// Invalid dates can show up as warnings (ie. "2007-02-99") and still return a DateTime object.
		$errors = \DateTime::getLastErrors();
		if ( $errors[ 'warning_count' ] > 0 ) {
			$this->error_code = Error\ErrorLoggerInterface::INVALID_DATE_FORMAT;

			return FALSE;
		}

		return $date;
	}
protected function convert_string( $value ) {

		$format = $this->input_data[ 'format' ];
		$date   = \DateTime::createFromFormat( $format, $value );

		// Invalid dates can show up as warnings (ie. "2007-02-99") and still return a DateTime object.
		$errors = \DateTime::getLastErrors();
		if ( $errors[ 'warning_count' ] > 0 ) {
			$this->error_code = Error\ErrorLoggerInterface::INVALID_DATE_FORMAT;

			return FALSE;
		}

		return $date;
	}
protected function convert_string ( $ value ) { $ format = $ this -> input_data [ 'format' ] ; $ date = \ DateTime :: createFromFormat ( $ format , $ value ) ; // Invalid dates can show up as warnings (ie. "2007-02-99") and still return a DateTime object. $ errors = \ DateTime :: getLastErrors ( ) ; if ( $ errors [ 'warning_count' ] > 0 ) { $ this -> error_code = Error \ ErrorLoggerInterface :: INVALID_DATE_FORMAT ; return FALSE ; } return $ date ; }
Attempts to convert a string into a DateTime object.

@param  string $value

@return bool|\DateTime
Attempts to convert a string into a DateTime object .