Reputation: 1125
I have to pass this format to hit third api
Format: "2015-09-30T14:15:11Z";
How can i achieve this using php.
Suppose current date time is 2018-07-18 12:23:10 and i want it to be like this "2018-07-18T12:23:10Z"
Upvotes: 0
Views: 29
Reputation: 539
Give a try with below
echo date("Y-m-d\TH:i:s\Z", strtotime("2018-07-18 12:23:10")) //2018-07-18T12:23:10Z
For current time you can use...
echo date("Y-m-d\TH:i:s\Z", strtotime(date("Y-m-d H:i:s"))) //2018-07-19T07:03:04Z
Upvotes: 1