I'm trying to calculate the value between two fields in my custom node.tpl file. I am trying to convert the code show on http://drupal.org/node/1364744, and I wrote the following one.
$birthday = format_date(strtotime($content['field_date_de_naissance']['#items']['value']), 'custom', 'd/m/Y'); $today = date('m/d/Y'); $age = $birthday->difference($today,'years'); print $age;
I get this error.
Fatal error: Call to a member function difference() on string in
What is wrong in my code?