determine week when pick a day

Posted by derikluv on Stack Overflow See other posts from Stack Overflow or by derikluv
Published on 2012-10-12T15:40:16Z Indexed on 2012/10/14 3:37 UTC
Read the original article Hit count: 137

Filed under:

I'm trying to accomplish the following task. I'm developing a custom calendar with three views (day,week and month), there may be something out there already but I'm rewriting this as part of learning tool for me as well.

So user will face with Day view when they first visit, with arrows to go back and forth to next day or previous day of course. If they click on Week View, it will give them a 7 days overview with today date as default, and once again they can go back and forth to next week or previous week. The last view is the full month calendar, once they click on the day, it will give them the detail of the day and at the same time reset the default as the day they pick. So if they go back to week view, they will see the detail for the week contain the day that they picked. This is where I have trouble wrapping my head around with, I know there are PHP functions that determine the day of the week but I can't seem to think about how to pass in the date and get the full week starting from Sunday for the day that passed in. For example, if I passed in 10/12/2012, I'd like to start the week at 10/07/12 - 10/13/12.

Thank you kindly for your help or pointing to the right direction. Please excuse my grammar/spelling mistakes as well.

© Stack Overflow or respective owner

Related posts about php