Hi, I've got a little nut that I need some help cracking:
I want to make a function that tells me which weekend a given date is. Keeping in mind, that a weekends are shifting at sundays (a weekend is defined as sun->sat). This means that the first weeekend in a month can actually be a date at the of the last month.
eg. 18-09-2000 is te 4th weekend of september.
Can anyone gimme some clues on this ones?
Try make a script using strftime, with some of the options available and a combination of more of the date/time functions in :
http://www.phpbuilder.com/manual/ref.datetime.php.
You also have to define a weekend where sat = end of month and sun = start of month !.
Lars Brandi Jensen
one quick idea springs to mind;
$t=mktime (0,0,0,09,18,2000) #beware the order of the arguments! $n=0; do { $n++; } while (09==date('m',($t-$n*604800))); #seconds in a week
echo "18-09-2000 is the ".$n."th week in septerber;
-- rad
actually, an even easier method just struck me;
$n=ceil($dayofmonth/7)