I Adar you to guess how they make it work!

by Michael S. Kaplan, published on 2011/12/15 07:36 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2011/12/15/10248139.aspx


The other day, when I blogged These aren't the MONTHS you're looking for (aka You'll never get to the 13th month *that* way), I oversimplified some of the described results in order to concentrate on proving that GetLocaleInfo was never returning the CAL_HEBREW (Hebrew calendar) months, without distracting the issue with other points.

The comments went slightly afield on other points, e.g. when Shachar Shemesh suggested:

Surely, the 12th month in the Hebrew calendar is אלול, not כסלו. Now, if you claim that the sixth month is אדר א׳ and the seventh אדר ב׳, then the 12th month would still be אב.‎ כסלו is the third month, either count.

Or is that what you meant by "but you probably know what I mean", in which case, I know what you mean, but not that you meant it.

Shachar

or when Alex Cohn commeted:

@Shahar, some would argue that Kislev is number 9, because the first month is Nissan! But anyway, I would choose Adar bet to occupy the 13th slot, to emphasize its conditional existence.

Obviously the NLS API has to make a decision somehow.

The Hebrew calendar works a little differently anyway, as I'll describe a little bit of now.

If you use GetCalendarInfo or GetCalendarInfoEx with CAL_HEBREW, here are the names you get:

Constant Month Name
CAL_SMONTHNAME1 תשרי
CAL_SMONTHNAME2 חשון
CAL_SMONTHNAME3 כסלו
CAL_SMONTHNAME4 טבת
CAL_SMONTHNAME5 שבט
CAL_SMONTHNAME6 אדר
CAL_SMONTHNAME7 אדר ב
CAL_SMONTHNAME8 ניסן
CAL_SMONTHNAME9 אייר
CAL_SMONTHNAME10 סיון
CAL_SMONTHNAME11 תמוז
CAL_SMONTHNAME12 אב
CAL_SMONTHNAME13 אלול

 Note that neither function takes an actual date value, so you have no way from just these functions to determine whether the 7th month entry wll be skipped or not for a given year.

Only when you format a date that uses this calendar can you determine whether that seventh entry is to be used.

And of course note that unlike the LOCALE_SMONTHNAME# constants, you cannot really equate the numbers in the CAL_SMONTHNAME# values -- the calendar itself does everything and doesn't give you easy methods to get additional information....

 Bonus thought:

Keeping in mind the differences I mentioned in I Adar you! Hell, I Double Adar you!, where are the other .Net names hidden now that Windows an .Net share data?


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day