2 dates, difference in days AARGH!!

From: Date: Wed, 11 Dec 2002 18:22:52 +0000
Subject: 2 dates, difference in days AARGH!!
Groups: php.general 
Request: Send a blank email to php-general+get-127863@lists.php.net to get a copy of this message
HI! I have two dates, one in the future, and the current date, I want to calculate the difference between the two in # of days. I have converted both dates to seconds: future date: <?$maturity_date = mktime (0,0,0,$mday_row[3],$mday_row[2],$mday_row[5]);?> current date: <?$today = getdate();?> <?$now_date = mktime (0,0,0,$today['month'],$today['wday'],$today['year']);?> Then I found the difference between the two: <?$difference_date = ($maturity_date - $now_date);?> Now I want to convert the difference to "days": <?$difference_days = ($difference_date / 86400);?> (24 [hours in a day] * 60 [minutes in an hour] * 60 [seconds in a minute] = 86400) This seems to make sense to me, but I don't get the answer I want. As a test I start with a date 14 days in the future, so I should come out with an answer of 14, but it comes out as 3! Please help this shoudln't be a big enough problem to throw me off schedule. Curtis

« previous php.general (#127863) next »