I am trying to find out the years, months, days and minutes between 2 timestamps.
I have used the following code, but it is not working:
$diff = time()-$res['asked_on'];
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
I am getting the output as:
0
0
0
$res['asked_on'] = 1331980897 ( It is also a time stamp getting from time() function )