Last modified using format_interval
Your code contains two errors:


You are using a variable which has not been initialized
You are passing the wrong arguments to format_interval()


The required arguments are:


$interval
It's not a timestamp, but the number of seconds until now. In your case, you should use time() - $node-&gt;changed.
$granularity
It's the number of units that are shown; if you pass 2 as value for $granularity and the interval is for 1 year, 3 months, and 2 weeks, format_interval() will return "1 year 3 months".
$langcode
It's the language code for the language to use. If you are hard-coding the language to be Arabic, you should use "ar".