note 62615 added to function.date

From: Date: Sun, 05 Mar 2006 11:27:57 +0000
Subject: note 62615 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-104844@lists.php.net to get a copy of this message
I really needed a simple function to tell me how many days had passed since a certain date. The closest function I found to do this was Brian W. Spolarich's function to check business days since a date. Thanks. The below code will tell you how many days have passed since 2006-01-01. <?php $date1 = mktime(0,0,0,1,1,2006); $date2 = mktime(0,0,0,date('m'),date('d'),date('Y')); $total_days = 0; while($date1 < $date2) { $total_days++; $date1 += 86400; } echo $total_days; ?> Cheers ---- Server IP: 203.114.129.125 Probable Submitter: 222.153.233.89 ---- 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/62615 Del: integrated -- http://master.php.net/note/delete/62615/integrated Del: useless -- http://master.php.net/note/delete/62615/useless Del: bad code -- http://master.php.net/note/delete/62615/bad+code Del: spam -- http://master.php.net/note/delete/62615/spam Del: non-english -- http://master.php.net/note/delete/62615/non-english Del: in docs -- http://master.php.net/note/delete/62615/in+docs Del: other reasons-- http://master.php.net/note/delete/62615 Reject -- http://master.php.net/note/reject/62615 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104844) next »