How to get xmldate from MySql date in php?

This post converting the MySql date format to xml date time format in php.

1. Code:

    format($format);
		return (false != $str) ? $str : null;
	}
	
	$str = "2018-11-15 00:00:00";	
	echo(convertMySqlDateToXmlDate($str));
    ?> 

2. Example:

Input:

"2018-11-15 00:00:00"

Output:

2018-11-15T00:00:00+00:00