private const int GanZhiStartYear = 1864; //干支计算起始年
private static string ganStr = "甲乙丙丁戊己庚辛壬癸";
private static string zhiStr = "子丑寅卯辰巳午未申酉戌亥";
public static string GanZhiYearString(int year)
{
string tempStr;
int i = (year - GanZhiStartYear) % 60; //计算干支
tempStr = ganStr[i % 10].ToString() + zhiStr[i % 12].ToString();
return tempStr;
}
C#天干地支计算
最新推荐文章于 2024-08-25 21:53:27 发布