As you may or may not be aware, Outlook supports multiple calendars. Not only does it support multiple calendars, it also supports alternate calendar types. Some languages that enable alternate calendars are Arabic, English, Hebrew, Hindi, Chinese, Japanese, Korean, and Thai.
In Outlook 2010 you can display an alternate calendar by performing the following steps.
When you view your calendar now you will see the date values displayed in the language you selected next to the date as it appears normally. So far, nothing has really changed other than how your calendar looks.
What happens if you want to create a monthly or yearly recurring appointment and you work with alternate calendars? You might ask yourself, which calendar should the appointment follow? How do you tell it which one to use? If you're using Outlook 2010, go ahead and try it. When you get to the Appointment Recurrence dialog everything looks normal until you select either the Monthly or Yearly recurrence option. When you select one of those options, some strange things happen that you might not have expected. You now have a choice of which calendar to use and when you switch between these options you will also see the values in a few of the drop down change to that language as well.
Did you know that not every calendar type has the same number of days in a month, or months in a year? As a test, create a yearly recurring appointment that starts on the same day for 2 different calendar types. I created one that starts on July 26th 2011 for both the Gregorian and Hebrew Lunar calendars. When I go look at July 26th 2012 I only see one of the yearly recurring appointments, the one for the Gregorian calendar. The one that I created for the Hebrew Lunar calendar actually appears on July 14th 2012.
How does this affect me as a developer?
Why is any of this important? If you are a developer implementing a calendaring system that synchronizes with Exchange Server you MUST be aware of this and take the calendar type into account when creating monthly or yearly recurring appointments.
Most of the properties of the RecurrrencePattern structure are fairly straight forward. However, there is one in particular that will cause you some grief if you are creating monthly or yearly recurring appointments, FirstDateTime.
The documentation provides the following description for calculating this value:
Let's walk through these steps and try to calculate the FirstDateTime for the July 26th appointment that we created for the Hebrew calendar. Along the way, we'll discover why the appointment shows up on July 14th 2012.
Using a tool like MFCMAPI, you can verify that this is correct. So, if you were a developer building a calendaring system that supported the Hebrew calendar and you need to sync with Exchange Server, that is how you would calculate the FirstDateTime field when you populate the RecurrencePattern structure.
So, can you figure out why the appointment we created on July 26th 2011 shows up next year on July 14th 2012? Go back to step 5 where we talk about the importance of the lunar month to the Hebrew calendar. The next occurrence of the appointment will be 1 year from July 26th 2011. But the lunar year has approximately 11 fewer days than the solar year. July 26 - 11 days = July 15. Well, that's not right. What's going on? Don't forget that 2012 is a leap year, so there's an extra day in February. The correct way to do it is to use the same method as in step 5, multiply 12 months by 29.53 lunar days and drop the decimal. You will see that the lunar year contains 354 days. Add 354 days to July 26th 2011, remembering that 2012 is a leap year and February has 29 days, not 28, and you will get July 14th 2012.