Re: getting days of week out of weeknumber and year

From: Date: Fri, 26 Jul 2002 14:16:23 +0000
Subject: Re: getting days of week out of weeknumber and year
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109715@lists.php.net to get a copy of this message
<? function retdays($year, $weekn) { $ar = array(); $weekn--; // adjust weeknumber (passed usually as 1 based but zero based is needed for calculations) // get base date $d = mktime ( 0, 0, 0, 1, 1, $year) + (3600 * 24 * 7 * $weekn) - 3600 * 24 * 2; for ($i=0;$i<7;$i++) { $d = $d + (3600*24); $ar[] = strftime ("%m/%d/%Y" , $d); } return $ar; } $d = retdays(2002, 5); var_dump($d); ?> did not yield same results as you posted, but it worked fine for the first 5,6 weeks. keep me posted, //elias "Rainer Schreiber" <rainer.schreiber@hairplus.nl> wrote in message news:20020726125453.80037.qmail@pb1.pair.com... > I am looking for a function wich can deliver me an array with the days of a > specific week. > The function should recieve $year and $weeknumber and return > $day[0]..$day[6]. > > f.i.: $year = '2002' and $weeknumber = '31' -> > $day[0] = '28-07-2002' > $day[1] = '29-07-2002' > $day[2] = '30-07-2002' > $day[3] = '31-07-2002' > $day[4] = '01-08-2002' > $day[5] = '02-08-2002' > $day[6] = '03-08-2002' > > Who can help me out? > > > -- > Rainer Schreiber [consulent] > Instituut Maidenhead / Hairplus > Hoekersingel 22 > 3028 XM Rotterdam > > Tel. 010-462.30.11 > Fax. 010-462.33.70 > E-mail. rainer.schreiber@hairplus.nl > > >

« previous php.general (#109715) next »