Re: Week calculating
| From: | nabil | Date: | Tue, 13 Jan 2004 13:29:51 +0000 |
| Subject: | Re: Week calculating | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174436@lists.php.net to get a copy of this message | ||
sorry but what do u think about this ?
<?php
for ($j=1;$j<13;$j++) {
for ($i=1;$i<32;$i++) {
$mk = mktime(0, 0, 0, $j, $i, 2004);
$datex = date ("l", $mk);
$daterest = date ("j/n/Y", $mk);
if ($datex == "Tuesday") {
echo $datex.">>>>>".$daterest."<br>";
}
}
}
?>
the problem that it outputs 6 weeks in March ... why ?
"Nabil" <nabil.attar@aws-syria.com> wrote in message
news:20040113130813.28142.qmail@pb1.pair.com...
> Greetings;
>
> I need a help here ... I want to make function that return the dates of
> Tuesdays in a given year
>
> Example::
>
> Calc_Tuesdays (2004);
>
> //and it should return or echo
> 2004-01-06
> 2004-01-13
> 2004-01-20
> 2004-01-27
> 2004-02-03
> .
> .
> etc .... ofcourse it should echo 5 Tuesdays in March by example
> so it should depends on the year not only current day+7
>
> any help please !!
> Nabil