Here is a PHP equivalent of the calculation. Just follow the comments and you should be able to convert it to PB.
Source:
<?
$date = strtotime ("February 23, 2003");
$date_str = date ("D F d, Y", $date);
$year = 2005;
echo "The date you entered was: $date_str\n";
// Calculate the week of the year
$week = date ("W", $date);
echo "$date_str is in week #$week of the year\n";
// Now calculate the Monday of the same week in $year
// First, find first monday of $year
$start_date = mktime (0, 0, 0, 01, 01, $year);
// Check if it's a Monday. If no, add enough to the date
// to make it to next monday. That will give us the beginning
// of the first week of the year.
$date_num = ((8 - date ("w", $start_date)) % 7);
// Now, add the number of weeks minus one to $date_num
// and find the beginning of the week we're looking for
$begin_week = mktime (0, 0, 0, 1, $date_num + 1 + 7 * ($week - 1), 2005);
$begin_week_str = date ("D F d, Y", $begin_week);
echo "Week $week of 2005 starts with " . $begin_week_str . "\n";
echo "According to the system, $begin_week_str is in week #" . date ("W", $begin_week) . " of 2005\n";
// Now, find the Friday of that week.
$end_week = $begin_week + 345600;
$end_week_str = date ("D F d, Y", $end_week);
echo "Week $week of 2005 ends with $end_week_str\n";
?>
[/code:1]
cheers
MM