the following code gives first date of week for the given date range. how to get week number from the date??? thanks.

<?php
$start = $week = strtotime('2011-01-01'); 
$end = strtotime('2011-02-01'); 
while($week < $end) {     
echo date('Y-m-d',$week), PHP_EOL;
//echo week num???      
$week = strtotime("+1 week", $week); 
}
?>

i solved it.. :)

<?php
$start = $week = strtotime('2011-01-01');
$end = strtotime('2011-02-01'); 
$year= date('Y ', $week);
$Jan1 = gmmktime(0, 0, 0, 1, 1, $year); 
while($week < $end) {     
echo date('Y-m-d',$week), PHP_EOL;
echo (int)(($week - $Jan1) / (7 * 24 * 60 * 60)) + 1, PHP_EOL;    
$week = strtotime("+1 week", $week); }
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.