View Single Post
Old 04-23-2008, 09:31 PM   #7 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,296
Thanks: 17
Village Idiot is on a distinguished road
Default

Thing is, he needs to know the dates of every day next week and has to be able to access them by day (monday, tuesday, ect). Those functions only say what next weeks today's date will be.

This will give you the dates of all the days next week, for a week.

PHP Code:
<?php
//get todays ISO-8601 numeric represenation of the date
$Today date("N");
$DayNames = array(1=>"Monday",2=>"Tuesday",3=>"Wednesday",4=>"Thursday",5=>"Friday",6=>"Saturday",7=>"Sunday");
$Days = array();

$DayOffset 0;
//generate all the days
for($i=0;$i<7;$i++)
{
    if(
$DayOffset 7-$Today)
    {
        
$DayOffset = -($Today-1);
    }
    
$Days[$DayNames[$Today+$DayOffset]] = date("Y-m-d",time()+(60*60*24*(7+$DayOffset)));
    
$DayOffset++;
}

echo 
$Days["Monday"] . "<br />";
echo 
$Days["Tuesday"] . "<br />";
echo 
$Days["Wednesday"] . "<br />";
echo 
$Days["Thursday"] . "<br />";
echo 
$Days["Friday"] . "<br />";
echo 
$Days["Saturday"] . "<br />";
echo 
$Days["Sunday"] . "<br />";
?>
As of 4/23/08, it outputs
2008-04-28
2008-04-29
2008-04-30
2008-05-01
2008-05-02
2008-05-03
2008-05-04
__________________

Village Idiot is offline  
Reply With Quote