I was just wondering how you can echo a range of dates in PHP
ideally i want the system to display this week wednesday to next week wednesday
for example
17/11/10 to 24/11/10
can anyone point me in the right direction?
i see no mention about mysql in your question, but if you're really talking about it:
select * from my_table where date_fld between '17/11/10' and '24/11/10'
create a date, and add days to it...
$m= date("m");
$de= date("d");
$y= date("Y");
for($i=0; $i<8; $i++){
echo date('d-m-y:D',mktime(0,0,0,$m,($de+$i),$y));
echo "<br>";
}
Since MySQL is tagged...
SELECT now(),
case
when weekday(now()) = 3 then date_sub(now(), interval 1 day)
when weekday(now()) = 2 then curdate()
when weekday(now()) = 1 then date_add(now(), interval 1 day)
when weekday(now()) = 0 then date_add(now(), interval 2 day)
when weekday(now()) = 4 then date_sub(now(), interval 1 day)
when weekday(now()) = 5 then date_sub(now(), interval 2 day)
when weekday(now()) = 6 then date_sub(now(), interval 3 day)
end as current_wednesday,
case
when weekday(now()) = 3 then date_add(now(), interval 6 day)
when weekday(now()) = 2 then date_add(now(), interval 7 day)
when weekday(now()) = 1 then date_add(now(), interval 8 day)
when weekday(now()) = 0 then date_add(now(), interval 9 day)
when weekday(now()) = 4 then date_add(now(), interval 5 day)
when weekday(now()) = 5 then date_add(now(), interval 4 day)
when weekday(now()) = 6 then date_add(now(), interval 3 day)
end as next_wednesday