SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    306
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question Print one year calendar from today in specific format

    Hello,

    I am having some issues trying to print out a calendar from today upto next year. Say today is April 5, 2013 the calendar should print dates up to April 4, 2014.

    The format I need the calendar printed is causing the issue. I can get dates printed from today up to next one year using

    Code:
     strtotime('+1 year'); and then printing dates from today to next year
    But I need the date to come up like this
    APRIL MAY
    SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
    5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 2 3 4

    This for each month up to April 4, 2014. How can this be achieved? Any ideas?

    Thanks in advance for all the help
    Last edited by jaagare; Apr 5, 2013 at 05:21. Reason: some table formatting issue so recreated the table
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  2. #2
    SitePoint Addict tlacaelelrl's Avatar
    Join Date
    Apr 2011
    Location
    Mexico city, Mexico
    Posts
    353
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    To start with you need to learn how the Gregorian Calendar is structured.

    That will give you an idea of how the calendar works and you can then work on a loop.

    You could get the current day of the year, day name, day number and also the month, then when a month like in February when you reach 29 you should check whether the year is leap or not and print accordingly but first I do recommend you you do get familiar with the calendar as that will help you figure out correctly what to do on the loop.

    Look specially t the part where it shows how many days are in each month as those are constant and is probably the easiest way to get your calendar going.
    Do you get bothered because I do the same thing every day?
    Do you question why I do it?
    Then find something that you actually like doing!!!

    Stop thinking on what I do.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    306
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Issue Solved

    Took help of this thread

    http://www.sitepoint.com/forums/show...between-2-days

    I achieved as per the example I had suggested in my earlier post. I had to loop 3 times once for Month & Year, Once for Day and Once for Date.

    Thanks
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •