public function stringToDateTime($string)
	{
		$date = date_create($string);
		$errors = \DateTime::getLastErrors();

		if ($errors['warning_count'] > 0 || $errors['error_count'] > 0)
			return null;

		return new DateTime($date->format(static::$dateTimeFormat));
	}
public function stringToDateTime($string)
	{
		$date = date_create($string);
		$errors = \DateTime::getLastErrors();

		if ($errors['warning_count'] > 0 || $errors['error_count'] > 0)
			return null;

		return new DateTime($date->format(static::$dateTimeFormat));
	}
public function stringToDateTime ( $ string ) { $ date = date_create ( $ string ) ; $ errors = \ DateTime :: getLastErrors ( ) ; if ( $ errors [ 'warning_count' ] > 0 || $ errors [ 'error_count' ] > 0 ) return null ; return new DateTime ( $ date -> format ( static :: $ dateTimeFormat ) ) ; }
Converts a string representation of a datetime into a DateTime object.

@param string $string A datetime in the form accepted by date_create()
@return DateTime
Converts a string representation of a datetime into a DateTime object .