用PHP计算日期间隔[重复]

Possible Duplicate:
Subtracting dates in PHP

I have two Unix timestamps, how can I calculate the total number of days between them?

$timestamp1 = x;
$timestamp2 = y;

$days_elapsed = floor(($timestamp2 - $timestamp1)/86400);

echo $days_elapsed;

Convert them to UNIX-timestamp (if they arent already), then just

$diff = abs($timestamp1 - $timestamp2);
$days = (int) ($diff / 60 / 60 / 24); 

something like this should do the trick:
$days = (strtotime($timestamp1)-strtotime($timestamp2))/(60*60*24);

This code should do the trick

$numDays = abs($timeOne - $timeTwo)/60/60/24;