RE: [PHP] counting with dates (help!)

From: Date: Mon, 07 Jan 2002 22:27:18 +0000
Subject: RE: [PHP] counting with dates (help!)
Groups: php.general 
Request: Send a blank email to php-general+get-79731@lists.php.net to get a copy of this message
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y))); > $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y))); > echo ($today - $last_week); > The result is a number like 8876 (20020107-20011231 = 8876) > But in date thinking it should be 7! No, that's the difference in time represented by the number of seconds. You still need to work with it a little more. 8876 / 60 = number of hours /* 60 = number of seconds in an hour */ 8876 / 60 / 24 = number of days. /* 24 = number of hours in a day */ Chris

« previous php.general (#79731) next »