php - Symfony2 Access Created Date Inside Controller -


i need able access created date inside controller because need send in json response, having issues though.

this works, json response dies because print_r prints object inside controller:

 print_r($validatelisting[0]->getcreated());  $date = $validatelisting[0]->getcreated()->date;  $createddate = date("m/d/y", strtotime($date)); 

this doesn't, , 1 need use can attach formatted date inside response.

 $date = $validatelisting[0]->getcreated()->date;  $createddate = date("m/d/y", strtotime($date)); 

when remove print_r(), fails... can make work?

this error get:

 notice: undefined property: datetime::$date in ... 

thanks!

$date = $validatelisting[0]->getcreated()->format('r'); $createddate = date("m/d/y", strtotime($date));

there no ->date attribute in datetime object, why php's complaining $validatelisting[0]->getcreated()->date.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -