RE: [PHP] calculate length between date to date

From: Date: Mon, 23 Apr 2001 04:28:48 +0000
Subject: RE: [PHP] calculate length between date to date
Groups: php.general 
Request: Send a blank email to php-general+get-49803@lists.php.net to get a copy of this message
> 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

« previous php.general (#49803) next »