首页 新闻 赞助 找找看

calendar 控件怎样加农历

0
[已关闭问题]

 怎么在asp.net中给现有的calendar控件加上农历

米西姆姆的主页 米西姆姆 | 初学一级 | 园豆:200
提问于:2008-12-25 17:13
< >
分享
其他回答(1)
0

上农历网论坛看看~~

bbs.nongli.com

BB_Coder | 园豆:797 (小虾三级) | 2008-12-25 17:41
0
可以参考以下示例
  1. TaiwanLunisolarCalendar cal =new TaiwanLunisolarCalendar()  ;  
  2. DateTime now  = DateTime.Now.AddYears(-1)  ;  
  3.   
  4. String 天干= "0甲乙丙丁戊己庚辛壬癸"  ;  
  5. String 地支= "0子丑寅卯辰巳午未申酉戌亥"  ;  
  6.     
  7. int lun60Year = cal.GetSexagenaryYear(now)  ;  
  8. int 天干Year = cal.GetCelestialStem(lun60Year)  ;  
  9. int 地支Year  = cal.GetTerrestrialBranch(lun60Year)   ;  
  10.     
  11. int lunMonth = cal.GetMonth(now)  ;  
  12. int leapMonth = cal.GetLeapMonth(cal.GetYear(now))  ;  
  13.     
  14. if (leapMonth > 0 && lunMonth >= leapMonth )   
  15. {  
  16.     lunMonth -= 1  ;  
  17. }  
  18. int lunDay = cal.GetDayOfMonth(now)  ;  
  19.     
  20. MessageBox.Show(String.Format("農曆:{0}年{1}月{2}日",  
  21.    天干[天干Year].ToString() + 地支[地支Year].ToString(), lunMonth, lunDay));  
风海迷沙 | 园豆:4453 (老鸟四级) | 2008-12-27 14:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册