> I have 2 variables here that store date start and date end, I 
> want to compare the lenght between the start date and the end 
> date, how would I do that?
> $dateStart = "$year" . "$mon" . "$date" ; ( for instance, it 
> will return "20010102")
> $dateEnd = "$yearEnd" . "$monEnd" . "$dateEnd" ; ( for 
> instance, it will return "20010201")
> 
> How do I calculate the length between those 2 variables?

<?
   $startunix = mktime(0, 0, 0, $month, $date, $year);
   $endunix   = mktime(0, 0, 0, $monthEnd, $dateEnd, $yearEnd);

   $difference = $endunix - $startunix;
?>

$difference now holds the number of seconds between those dates,
which you can use to find out how far apart they are.

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to