您好,登錄后才能下訂單哦!
這篇文章主要講解了“C#如何實(shí)現(xiàn)中文日歷Calendar”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“C#如何實(shí)現(xiàn)中文日歷Calendar”吧!
Object<-----Calendar<-----EastAsianLunisolarCalendar<-----ChineseLunisolarCalendar(農(nóng)歷)
System.Globalization.ChineseLunisolarCalendar cc =new System.Globalization.ChineseLunisolarCalendar(); s1=cc.MinSupportedDateTime.ToString("");//02/19/1901 00:00:00 s2=cc.MaxSupportedDateTime.ToString("");//01/28/2101 23:59:59
System.Globalization.ChineseLunisolarCalendar cc =new System.Globalization.ChineseLunisolarCalendar(); s1=cc.GetMonthsInYear(DateTime.Now.Year).ToString();//12,一年中有幾個(gè)月,13表示當(dāng)年有閏月。 s2=cc.GetDaysInYear(DateTime.Now.Year).ToString();//354,一年中有多少天 s3=cc.GetDaysInMonth(DateTime.Now.Year,DateTime.Now.Month).ToString();//29 ,當(dāng)月中有多少天
System.Globalization.ChineseLunisolarCalendar cc =new System.Globalization.ChineseLunisolarCalendar(); s1=cc.GetSexagenaryYear(DateTime.Now ).ToString();//36,天干 s2=cc.GetTerrestrialBranch(36).ToString();//12,地支
System.Globalization.ChineseLunisolarCalendar cc =new System.Globalization.ChineseLunisolarCalendar(); s1=cc.GetYear(DateTime.Now).ToString();//;2019 s2=cc.GetMonth(DateTime.Now).ToString();//;5,注意:其返回值為1-13的數(shù),如果該年四月有閏月,4月返回4,閏4月則返回5 s3=cc.GetDayOfMonth(DateTime.Now).ToString();//;23
System.Globalization.ChineseLunisolarCalendar cc =new System.Globalization.ChineseLunisolarCalendar(); s1=cc.IsLeapYear(DateTime.Now.Year).ToString();//;False s2=cc.GetLeapMonth(DateTime.Now.Year).ToString();//;0,注意:表示所閏月份。如果返回5,表示閏4月。
string[] monthName = {"正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "東", "臘" }; System.Globalization.ChineseLunisolarCalendar cc = new System.Globalization.ChineseLunisolarCalendar(); int currentMonth = cc.GetMonth(DateTime.Today); int leapMonth = cc.GetLeapMonth(DateTime.Today.Year); string realMonth; if (currentMonth < leapMonth) realMonth = monthName[currentMonth]; else if (currentMonth == leapMonth) realMonth = "閏" + monthName[currentMonth - 1]; else realMonth = monthName[currentMonth - 1]; s1 = realMonth.ToString();//;五
感謝各位的閱讀,以上就是“C#如何實(shí)現(xiàn)中文日歷Calendar”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)C#如何實(shí)現(xiàn)中文日歷Calendar這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。