I saw a date/time format in a PHP code that has something like this:
2015-06-19T00:38:04Z
How can I generate a datetime having that kind of format?
I know this kind of format date("Y-m-d H:i:s");
outputs different 2015-06-19T00:38:04Z
because it has a T
and a Z
.
So it's like I want to get the current date/time having a T
and a Z
Escape T and Z in format
echo date("Y-m-d\TH:i:s\Z"); // 2015-06-17T16:50:50Z
UPDATE Thanks to Lithis. To take a GMT/UTC time
echo gmdate("Y-m-d\TH:i:s\Z"); // 2015-06-17T17:06:06Z