Private stringGetweek (intDayOfWeek) {stringReturnweek = "";Switch(DayOfWeek) { Case1:returnweek = "Monday"; Break; Case2:returnweek = "Tuesday"; Break; Case3:returnweek = "Wednesday"; Break; Case4:returnweek = "Thursday"; Break; Case5:returnweek = "Friday"; Break; Case6:returnweek = "Saturday"; Break; Case0:returnweek = "Sunday"; Break; }returnReturnweek; }
Private stringGetchinesedatetime (datetime datetime) {Chineselunisolarcalendar Chinadata =NewChineselunisolarcalendar ();intLyear = Chinadata.getyear (datetime);intLmonth = Chinadata.getmonth (datetime);intLday = Chinadata.getdayofmonth (datetime);//Get leap month, 0 means no leap month intLeapmonth = Chinadata.getleapmonth (lyear);BOOLIsleap =false;if(Leapmonth > 0) {if(Leapmonth = = Lmonth) {//Leap monthIsleap =true; lmonth--; }Else if(Lmonth > Leapmonth) {lmonth--; } }//10 days Dry string[] Tiangan = {"Armor", "b", "C", "Ding", "e", "own", "Geng", "Xin", "Ren", "GUI" };//12 Terrestrial string[] Dizhi = {"Child", "Ugly", "Yin", "Mao", "Chen", " has", "Noon", "not", "Shen", "Unitary", "Xu", "Hai" };//12 Zodiac string[] Shengxiao = {"Rat", "Cattle", "Tiger", "Free", "Dragon", "Snakes", "Horse", "Sheep", "Monkey", "Chicken", "Dog", "Pig" };stringChinayear = "";if(Lyear > 3) {intTgindex = (lyear-4)% 10;intDzindex = (lyear-4)% 12; Chinayear =string. Concat (Tiangan[tgindex], Dizhi[dzindex], "[", Shengxiao[dzindex],"]"); }string[] months = {"is", "two", "three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "10", "11", "12 (wax)" };stringChinamonth = "";if(Lmonth < && lmonth > 0) {chinamonth = months[lmonth-1]; }string[] days1 = {"Early", "10", "20", "three" };string[] days = {"a", "two", "three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "10" };stringChinaday = "";if(Lday > 0 && lday < 32) {if(Lday! = && Lday! = 30) {Chinaday =string. Concat (days1[(LDAY-1)/ten], days[(lday-1)% 10]); }Else{Chinaday =string. Concat (days[(LDAY-1)/ten], days1[1]); } }return string. Concat (Chinayear, "years", Isleap?"Leap" :string. Empty, "\ r \ n Lunar", Chinamonth,"Month", Chinaday);//return "Lunar" + chinamonth + "month" + chinaday;}
C # Gets the day of the week and lunar date based on the current date