February 22, 2005

rokuyo

i seem to have datetime on the brain this month. one of the trickier things i've been trying to get a handle on was how to calculate japanese "rokuyo". what's "rokuyo"? well, let me tell you....

a lunar calendar was used in japan from the 14th to the 19th century. that calendar had a six day week and those six days were known as rokuyo. and like any other calendar system, each day had a name and a particular meaning (you do know that the english weekdays are named after one of the seven "planets" of ancient times?). and of course, each day had a significance:
  • sakigachi good luck in the morning, bad luck in the afternoon
  • tomobiki good luck all day, except at noon
  • sakimake bad luck in the morning, good luck in the afternoon
  • butsumetsu Unlucky all day, as it is the day Buddha died
  • taian 'the day of great peace', a good day for ceremonies
  • shakku bad luck all day, except at noon
source

while i'd guess few people would admit to closely adhering to this system, it does invoke some strange "better safe than sorry" behaviors. for instance, some hospital patients in japan won't agree to be discharged on butsumetsu day, as it's regarded as being very unlucky. rather they'd stay the extra 24 hours to be discharged on a lucky taian day.

the calculations for determining rokuyo turn out to be surprisingly difficult. in fact, the only published code i ever saw for this was developed by Eirik Rude, a cf developer (at that time living in japan). the complexity comes from the need to calculate lunar months (remember the old japanese calendar?). since i wanted to integrate this functionality with our existing icu4j-based calendars, i poked thru the lunar calendars (chinese, islamic and hebrew) that i knew about to see if we could use any of these. of course, the old japanese lunar calendar was basically the lunisolar chinese calendar. using Eirik's basic logic and the icu4j library i was able to considerably reduce the code's complexity (the complexity's still there, but i pushed it down into the icu4j java library where smarter people than i have already dealt with it).

the rokuyo testbed is here and the i18n calendars package incorporates this new functionality (pick japanese calendar from the select). and this is a good resource if you want to read more about rokuyo.

1 Comments:

At 2/22/2005 10:12 PM, Anonymous felix said...

english day names are from celestial objects and norse gods.

monday - moon's day
tuesday - tiw's day
wednesday - odin's day
thursday - thors day
friday - freya's day
saturday - saturn's day
sun day - sun's day

 

Post a Comment

<< Home