I have this var in my twig templete:
{{aWorker.timeToRetirement|date('Y-m-d')}}
when I execute the page it's returning exactly this text: 'Y-m-d' without '' of course. Now what I really want to get is the difference between 2 dates, lets say a future date (is the retirement date of a person/worker you can get more info about what I'm doing if u need it here) '2060-12-01' and today's date '2013-10-03'. I want to do that using this var and method in my Entity class:
//...
//Var containing the retirement date
private $retireYear;
//var to store time to retirement from today
private $timeToRetirement;
//...
public function getTimeToRetirement (){
$this->timeToRetirement = $this->retireYear->diff(new \DateTime('today'));
return $this->timeToRetirement;
}
What am I doing wrong? whay is the var not returning the difference between today and the retirement date