calendar.class.php updates and new version release

Just put up the new version of my php calendar class (version 2.7).

This version integrates a fix for the start of the week bug people were seeing with PHP version < 5.1. Also, the license has changed. The class is now licensed under the GPL for use in open source projects. So if you want to use the class in a project that you plan to release under the GPL or compatible open source licenses, you now can. If you need to use the class in a closed source project, or don't want to distribute your project (ie commercial use) please contact me. And last, but by far not the least... I setup the project on Google Code. The code is available in SVN or as a zip download. So grab the newest version here

I’ll be filling in the Wiki with documentation shortly. In the mean time the old calendar.class.php page still has some usage info and links to my other blog posts about using the class in many interesting ways. In addition, the release version still contains plenty of use examples and you can always leave a comment or use the contact form if you have any questions.


  1. Jason Locashio

    # April 4, 2010 - 3:02 pm

    I’m not sure if you are still working on this project or supporting it at all, but one thing I’ve noticed its missing is the ability to add class or id parameters to the linked dates. With the rise of javascript frameworks such as JQuery and Prototype, as well as the move towards web 2.0 as typical design practice, the ability to call an HTML structure within the parent window on click is almost a necessity.

  2. Jim Mayes

    # April 4, 2010 - 3:27 pm

    Yes, I’m still supporting the class and actually planning a complete rebuild of the class in the very near future. I see the class as utilitarian so my aim has been to keep it functionally lean and simple. So a lot of requests for new functionality don’t see their way into official release. However, I think what you’re describing could fit in to the purpose of the class. Thanks for the suggestion!

  3. Alex Qiu

    # June 8, 2010 - 7:07 am

    I think it’s better to add the ability work with javascript to change Month or Year by the viewer.

  4. Juozas

    # June 15, 2010 - 3:41 am

    Hello, great class. I wonder why it hasn’t ability to set controls for previous/next month. Is there some tips for this?

  5. Christiano Seppala

    # October 5, 2010 - 2:15 pm

    I added controls for prev/next like this (your mileage may vary):

    $first_day = $this->year . “-” . $this->month . “-01″;
    $previous_year = date(“Y”, strtotime(“-1 month”, strtotime($first_day)));
    $previous_month = date(“m”, strtotime(“-1 month”, strtotime($first_day)));
    $next_year = date(“Y”, strtotime(“+1 month”, strtotime($first_day)));
    $next_month = date(“m”, strtotime(“+1 month”, strtotime($first_day)));
    $previous_link = $previous_year . ‘-’ . $previous_month . ‘-01′;
    $next_link = $next_year . ‘-’ . $next_month . ‘-01′;

    $output .= “«   ” . ucfirst(strftime(“%B %Y”, $month_start_date)) . “   »\n”;

  6. Christiano Seppala

    # October 6, 2010 - 12:08 pm

    The last line should be…

    $output .= “<a href=’calendar.php?date=” . $previous_link . “‘>«</a>   ” . ucfirst(strftime(“%B %Y”, $month_start_date)) . “   <a href=’calendar.php?date=” . $next_link . “‘>»</a>\n”;

Leave a Reply