<%! public String FormatTitle(java.util.Calendar thisCal) { java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat ("MMMMMMMMM d, yyyy"); return (formatter.format(thisCal.getTime())); } %> <% java.util.Calendar currentCal = java.util.Calendar.getInstance(); %> Calendar
Make your own free website on Tripod.com
<% // Set the current day of the month int currentDay = currentCal.get(currentCal.DAY_OF_MONTH); // Calculate the totals days in the month int daysInMonth = currentCal.getActualMaximum(currentCal.DAY_OF_MONTH); if (daysInMonth != 1) { out.println(""); out.println(" "); } // Calculate the day of the week for the first currentCal.set(currentCal.DAY_OF_MONTH, 1); int dayOfWeek = currentCal.get(currentCal.DAY_OF_WEEK); if (dayOfWeek != 1) { out.println(""); out.println(" "); } // Prefill the calendar with blank spaces if (dayOfWeek != 1) { out.println(" "); } // Fill in dates for (int day=1; day <= daysInMonth; day++) { if (day == currentDay) { out.println(" "); } else { out.println(" "); } if (dayOfWeek == 7) { out.println(" \n\n "); dayOfWeek = 1; } else { dayOfWeek++; } } // Postfill the calendar with blank spaces if ((8-dayOfWeek) != 0) { out.println(" "); } %>
<%= FormatTitle(currentCal) %>
SUN MON TUE WED THU FRI SAT
 " + day + "" + day + "