Algorithm to find the Gregorian date of the Chinese New Year of a certain Gregorian year

江枫思渺然 提交于 2019-12-03 17:11:05

For Chinese New Year, I think this would work:

ChineseLunisolarCalendar chinese   = new ChineseLunisolarCalendar();
GregorianCalendar        gregorian = new GregorianCalendar();

DateTime utcNow = DateTime.UtcNow;

// Get Chinese New Year of current UTC date/time
DateTime chineseNewYear = chinese.ToDateTime( utcNow.Year, 1, 1, 0, 0, 0, 0 );

// Convert back to Gregorian (you could just query properties of `chineseNewYear` directly, but I prefer to use `GregorianCalendar` for consistency:

Int32 year  = gregorian.GetYear( chineseNewYear );
Int32 month = gregorian.GetMonth( chineseNewYear );
Int32 day   = gregorian.GetDayOfMonth( chineseNewYear );

Because the Chinese Calendar is very complex (and based astronomical considerations) there is no simple way to calculate the Gregorian date of a Chinese New Year which is correct in all cases. (There are some 'rules of thumb' which always fail for some years.) For the underlying theory see here and for Windows software to do this (and other Chinese Calendar calculations) see here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!