Haven't had too much time to play with it, but give it a shot
<?
function get_week($month, $day, $year) {
/*
Function to get the week number
for the date passed to it. Since
we're using date("W"), this
function assumes weeks start
on Monday.
*/
/* Make a readable format */
$dt = $year."-".$month."-".$day;
/* Check if date is valid */
if(checkdate($month, $day, $year)) {
/* Get week of year for date given */
$weeknr = date("W",strtotime($dt));
/* Get week of year for first of the month */
$mweeknr = date("W",strtotime($year."-".$month."-01"));
/* Calculate difference */
$week = ($weeknr - $mweeknr)+1;
return $week;
}
else {
return "Invalid date (".$dt.")";
}
}
echo get_week(10,26,2003);
?>