Jump to content

Printing months and weeks


Canman2005

Recommended Posts

Hi all

 

Is it easy to print a list of months starting from a date set by

 

$start = 2008-09-01;

 

so it displays

 

September 2008

October 2008

November 2008

December 2008

 

then print the weeks under each month, so it would look like

 

September 2008

Week 1 - 2008-09-01

Week 2 - 2008-09-08

Week 3 - 2008-09-15

Week 4 - 2008-09-22

Week 5 - 2008-09-29

October 2008

Week 1 - 2008-10-01

Week 2 - 2008-10-08

Week 3 - 2008-10-15

Week 4 - 2008-10-22

Week 5 - 2008-10-29

 

thanks

Link to comment
Share on other sites

Perhaps I wasn't clear about that.

 

While the first seven days of October 2008 do begin at 2008-10-01, conventional thinking is that the first week of October actually begins on Monday October 6.

 

Before anyone dashes off some code ... and a few minutes reviewing how the date() function works would help ... you need to define clearly what you really want.

Link to comment
Share on other sites

<Off topic>

I can only speak for myself, but if ask for clarification of requirements, or the output from a specific piece of code, and get a negative or unhelpful response I immediately unsubscribe from that thread. We're willing to help but sometimes we need a bit of help from the OP to solve a problem.

 

I think you are lucky Andy is still in there.

Link to comment
Share on other sites

Thanks

 

I have had a look, I see you can get the last monday by using

 

date("d/m/Y",strtotime("last Monday"));

 

but how would you say

 

monday before last

and the monday before that

 

etc, can you just do

 

date("d/m/Y",strtotime("last Monday"));

 

and then run a -7 days?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.