In message <[EMAIL PROTECTED]>, Citoyen Christer
<[EMAIL PROTECTED]> writes
>Hi all!
>I have a (working) function to get a datestring
>out of a given year, week (of year) and day (of month).
>
>function week2date2($year, $week, $day)
>{
>    $Jan1 = mktime(1,1,1,1,1,$year);
>    $offset = (11-date('w',$Jan1))%7-3 + $day;
>    $desiredDay = strtotime(($week-1) . ' weeks '.$offset.' days', $Jan1);
>    return $desiredDay;
>}
>I.e 2007,31,4 as arguments returns a date (1186095661)
>that is therefter formatted to a datestring: 
>date("Y-m-d", $date) returns '2007-08-03' in this example.
>My question is, can I rework the week2date2() to take the number
>of a month (1-12) instead of the number of a week (1-52), and still
>get the same resulting datestring  ???
>I have tried a lot of variants, but I am lost on this one!  
>Any help is much appreciated.
>Regards, /Kris

I think that I may be misunderstanding, but...

You have mktime, so in
function month2date2( $year, $month, $day )

you could include
mktime ( 0, 0, 0, $day, $month, $year )

But why don't you just use 
"$year-$month-$day" ?

But that seems to simple, so I assume that I have missed a point in your
post.

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

Reply via email to