12.4. Generating calendars

12.4.1. Adding a month calendar to a page

Without doubt, another popular use of the date object is to generate a calendar. Since we know how to get the year, month, and date from a date object, to generate a calendar is just a formatting process. Our first aim here is to generate the current month calendar to a page. Consider the following example code ex12-18.htm:

Example. ex12–18.htm – A Page To Show A Month Calendar
 1: <?xml version="1.0" encoding="iso-8859–1"?> 2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 5: <head><title>A Month Calendar -- ex12–18.htm</title></head> ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.