PHP Calendar Menu
A simple calendar menu which displays a calendar month and allows you to click on a day to fill in a form. I used this for an event calendar application when creating new events.
I also wrote a similar calendar in ASP, so I you can download the JScript ASP source code for that calendar below. Note it is different then the PHP version shown here.
PHP has some great date function capabilities such as built in support for textual Months and Days. Plus it can even display the appropiate suffix on a day. ('st', 'nd' 'rd', 'th' in 1st, 2nd, 3rd 4th). View the source code and the PHP documentation to see how these functions are used.
The concept behind generating the month is straightforward. Grab today's date, from that get the month and year and create a new date of the first of the month. From this date you can figure out which day of the week it falls on.
You then need to figure out the last day of the month, I looped through the days 28th - 32nd and created a new date out of it and compared the current month to this new date's month. If it changed the previous day was the last day of the month.
You then just start on the first day, postitioning yourself over however many weekdays the first is in, and then just loop through all the days until the day reaches the end of the month. Keep track of the weekdays using modulus 7 to find the end of each week.

| Price: | N/A FREE | Hits: | 5536 |
| File Size: | Platforms: | Linux | |
| Ratings: | Last Updated: | 2005-11-22 |
VIEW ALL
PHP