note 63754 added to function.date

From: Date: Thu, 30 Mar 2006 03:14:51 +0000
Subject: note 63754 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-106988@lists.php.net to get a copy of this message
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. ---- Server IP: 61.195.146.164 Probable Submitter: 203.140.174.182 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/note/edit/63754 Del: integrated -- http://master.php.net/note/delete/63754/integrated Del: useless -- http://master.php.net/note/delete/63754/useless Del: bad code -- http://master.php.net/note/delete/63754/bad+code Del: spam -- http://master.php.net/note/delete/63754/spam Del: non-english -- http://master.php.net/note/delete/63754/non-english Del: in docs -- http://master.php.net/note/delete/63754/in+docs Del: other reasons-- http://master.php.net/note/delete/63754 Reject -- http://master.php.net/note/reject/63754 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#106988) next »