Please see http://php.net/manual/en/function.date.php
I’m not sure that I understood you in the correct way, but in case if .000 means milliseconds and -00:00 means difference to Greenwich time (GMT) in hours, than that’s an answer:
$date = new \DateTime('now');
var_dump($date->format("Y-m-d\Th:i:s.vP"));
Output: string(29) “2017-11-27T08:37:56.449+00:00”
As far as v option was added just in PHP7 you may use the following code in earlier versions:
$date = new \DateTime('now');
$milliseconds = substr(round($date->format('u'), -3), 0, 3);
var_dump($date->format("Y-m-d\Th:i:s.").$milliseconds.$date->format('P'));
4
solved How to build this date and store it as a string?