I'm trying to assign weeks from 1 - 5 for days in a month i.e
Day 1 - 7 = Week 1
Day 8 - 14 = Week 2
Day 15 - 21 = Week 3
Day 22 - 28 = Week 4
Day 23 - 31 = Week 5
for all the month in a normal year and leap year.
My question is: for a month like September 2012 (Sunday - Saturday) where Sept 1 is the last day for Week 35, and Sept 30 is the beginning of Week 40, thereby not making the weeks unique.
Will my week numbering be always true ?
I'm getting days of the month like this. Also this code was used to get Weeks from 1 - 53. But I only want week 1 - 4/5 for individual months.
$month array('january'.........'december');
$year = array('2011',........'2099');
for($i=0; $i<count($year); $i++){
for($j=0; $j<count($month); $j++){
$stamp = strtotime("last Monday of $month[$j] $year[$i]");
$date = date("d-M-Y", $stamp);
$newdate = explode("-", $date);
echo "Day - $date[0]". "<br>";
echo "Month - $date[1]". "<br>";
echo "Year - $date[2]". "<br><br>";
(int) (date('d', $date) / 7) + 1
. Depends what you need. Please clarify what output you need. – Mikulas Dite