Not able to display DateTime from json on page with PHP -


i have json data have pulled api looks following:

{   data: {     loans: {       totalcount: 301,       values: [         {         name: "anastacia",         status: "fundraising",         plannedexpirationdate: "2017-08-19t22:10:06z"         },         {         name: "mercy",         status: "fundraising",         plannedexpirationdate: "2017-08-19t22:10:05z"         }       ]     }   } }  

i able display names , totalcount on page, not plannedexpirationdate.

$json_a = json_decode($curl_response, true);  //this works: echo $json_a['data']['loans']['values'][0]['name'];  //this not: echo $json_a['data']['loans']['values'][0]['plannedexpirationdate'];  //this not either. prints date in 1970. $date= $json_a['data']['loans']['values'][2]['plannedexpirationdate']; echo date('d-m-y h:i:s', strtotime($date)); 

the datetime class great replacement achieve wish.

eg.

$d = new datetime($date); echo $d->format('d-m-y h:i:s'); 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -