If you've read any of the past topics, you'll note that I've been on a big microformat kick lately (similar to my extender kick, graphics, etc.). And sadly it probably wont stop today. Today I bring you the hCalendar format. The hCalendar format is simply a way of displaying calendar events in a human/computer readable format (and like other microformats, it's basically an HTML friendly version of another format which in this case is vCalendar). It's widely used on a number of websites including MapQuest Local, last.fm, Facebook, etc.
The concept is very simple, we simply start off with some entity (div, span, etc.) that has a class of vevent. Inside that we place the actual data. Dates plus a couple other items are placed within abbr items with the appropriate class name, everything else is placed in whatever node type you want. As far as what the class types are, it's a basic copy from vCalendar. So we have dtstart (start time), dtend (end time), location (location of the event), summary (a basic title for the event usually), url (points to a location where more info about the event can be found usually), description (actual description of the event), etc. So if we do the following:
<div class="vevent">
<span class="summary">An Event</span>
<span class="location">Somewhere</span>
<abbr class="dtstart" title="04/21/2009">April 21, 2009</abbr> to <abbr class="dtend" title="04/22/2009">April 22, 2009</abbr>
<span class="description">This is the description of the event</span>
</div>
We end up with an hCalendar event called An Event that is being held at Somewhere, on April 21 through 22 of 2009, with a basic description of the event. That's all there is to it really. But to help you out, I modified my vCalendar code a bit by adding a function to automatically export the event to an hCalendar item as well.
VCalendar.zip (1.83 kb)
The code is documented so it shouldn't be too difficult to figure out hopefully. You'll notice that it has a legal notice at the top of it as well. The reason for this is it's going into the Utility Library that I created (which I'll be moving to CodePlex some time this week). Anyway, download the code, leave feedback, and happy coding.
2d6d9ba0-1a17-4c51-95dd-63af24f9a0b9|0|.0