I just recently had to calculate the diff between 2 dates from a DB. Here's the trick I used:
<?
//give these the dates from DB
//ps. I used noon to avoid TZ error
$date1 = date("Y/m/d 12:00");
$date2 = date("Y/m/d 12:00");
//gotta change '-'s to '/'s
$date1 = ereg_replace("-", "/", $date1);
$date2 = ereg_replace("-", "/", $date2);
//convert to UNIX timestamp
$date1 = strtotime( $date1 );
$date2 = strtotime( $date2 );
//86400 is # secs in a day
$daysdiff = (($date2 - $date1) / 86400 );
//604800 is # secs in a week
$weeksdiff = (($date2 - $date1) / 604800 );
?>
This does the trick for me.
-Alan