Home > Archive > PHP DB > June 2004 > Re: [PHP-DB] Date help needed
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PHP-DB] Date help needed
|
|
| Justin Patrin 2004-06-24, 6:08 pm |
| You could loop through the w s and put those 3 specifically in:
$days = array();
for($i = 0; $i < 365; $i +=7) {
$days[] = strtotime('next Monday', strtotime('+ '.$i.' days'));
$days[] = strtotime('next Friday', strtotime('+ '.$i.' days'));
$days[] = strtotime('next Sunday', strtotime('+ '.$i.' days'));
}
sort($days);
foreach($days as $day) {
echo date('Y-m-d', $day).'<br/>';
}
(This is not tested, but it *should* work,)
On Thu, 24 Jun 2004 17:07:12 -0400, Chris Payne
<chris_payne@planetoxygene.com> wrote:
>
> Hi there everyone,
>
> I have a problem, I currently have some code which populates a dropdown box
> - this code gives me every day for the next x amount of days (EG: a years
> worth of days), however what I really need to be able to do, is to find a
> way to display this data in the dropdown box but ONLY show 3 days a w ,
> IE: Mondays, Fridays and Sundays, so it would show the dates for each
> Monday, Friday and Sunday for X amount of days (IE: 365 days in the
> dropdown).
>
> Does anyone have any idea how to do this? I would really appreciate any
> help, I'd send my sample code only I'm not at my home/work computer ATM.
>
> Chris
>
> !DSPAM:40db40cb34094233914063!
>
--
paperCrane --Justin Patrin--
| |
| Chris Payne 2004-06-24, 6:08 pm |
| Hi there,
Just got back and tried it and it works perfectly, thank you so much for
your help, you've got me out of a bind here ;-)
Chris
You could loop through the w s and put those 3 specifically in:
$days = array();
for($i = 0; $i < 365; $i +=7) {
$days[] = strtotime('next Monday', strtotime('+ '.$i.' days'));
$days[] = strtotime('next Friday', strtotime('+ '.$i.' days'));
$days[] = strtotime('next Sunday', strtotime('+ '.$i.' days'));
}
sort($days);
foreach($days as $day) {
echo date('Y-m-d', $day).'<br/>';
}
(This is not tested, but it *should* work,)
On Thu, 24 Jun 2004 17:07:12 -0400, Chris Payne
<chris_payne@planetoxygene.com> wrote:
>
> Hi there everyone,
>
> I have a problem, I currently have some code which populates a dropdown
box
> - this code gives me every day for the next x amount of days (EG: a years
> worth of days), however what I really need to be able to do, is to find a
> way to display this data in the dropdown box but ONLY show 3 days a w ,
> IE: Mondays, Fridays and Sundays, so it would show the dates for each
> Monday, Friday and Sunday for X amount of days (IE: 365 days in the
> dropdown).
>
> Does anyone have any idea how to do this? I would really appreciate any
> help, I'd send my sample code only I'm not at my home/work computer ATM.
>
> Chris
>
> !DSPAM:40db40cb34094233914063!
>
--
paperCrane --Justin Patrin--
|
|
|
|
|