How to break month/year date range into weeks in display

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

How to break month/year date range into weeks in display

Post by amir »

Whats the best way to do this: I have to run a report which takes a date range. My date range is structured as dropdowns , so FromMonth/FromYear - ToMonth/ToYear - these are basically 4 dropdowns. In the report its supposed to break down weekly. So if i selected between August/2006 - September/2006. Then there would be 10 columns with August-week1, August-week1, August-week1, August-week1, August-week1, September-week1, September-week2, .....till 5th week of september. In the rows it would have the quantity of each product. In the database a date has a quantity associated with it.

so lets the say a date is the 9th Aug. then it would fall on august-week2

How do i go about acheiveing all this??

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The date() function can return the week number of a given time.
Post Reply