note 98003 deleted from function.date by danbrown

From: Date: Thu, 20 May 2010 15:47:19 +0000
Subject: note 98003 deleted from function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169462@lists.php.net to get a copy of this message
Note Submitter: enrico dot tracanzan at NOSPAM dot libero dot it ---- <?php // This is a really fast and efficient code that finds only specific week days between two dates. // In this example it finds all Tuesdays between May the 15th 2010 and June the 2nd 2010. // If you wish to list all the dates between $startdate and $enddate simple remove the IF statement as told below ('remove this line'). // You may also use this code to get the number of days between two dates in a more efficient manner. $startdate = strtotime('2010-05-15'); $enddate = strtotime('2010-06-02'); $weekday = "Tue"; $dates = array(); echo $weekday." happens on: <br />"; while($startdate <= $enddate) { if (stristr(date('D Y-m-d', $startdate), $weekday)) { // remove this line array_push($dates, date('Y-m-d', $startdate)); } // remove this line $startdate += 86400; } print_r($dates); ?>

« previous php.notes (#169462) next »