note 98003 deleted from function.date by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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);

?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.