note 63754 deleted from function.date by derick

From: Date: Sun, 11 Jun 2006 11:44:50 +0000
Subject: note 63754 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114258@lists.php.net to get a copy of this message
Note Submitter: davidwhthomas at gmail dot com ---- I needed to calculate the difference between two dates in days based on current date and a date from the DB. This will be used to check if a members subscription has lapsed ( i.e 365 days have passed ). Here's the (simple) code: //calculate the difference between two dates in days. $regDate=strtotime("July 15, 2005"); //will come from DB $curDate=mktime(); //current UNIX timestamp. $diff= $curDate - $regDate; //date diff in seconds $diff = $diff / 86400; //date diff in days echo $diff; //will be used to check member subscription hope it helps someone.

« previous php.notes (#114258) next »