您好,登錄后才能下訂單哦!
這篇文章主要講解了“C#如何實現中文日歷Calendar”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“C#如何實現中文日歷Calendar”吧!
Object<-----Calendar<-----EastAsianLunisolarCalendar<-----ChineseLunisolarCalendar(農歷)
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,一年中有幾個月,13表示當年有閏月。 s2=cc.GetDaysInYear(DateTime.Now.Year).ToString();//354,一年中有多少天 s3=cc.GetDaysInMonth(DateTime.Now.Year,DateTime.Now.Month).ToString();//29 ,當月中有多少天
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的數,如果該年四月有閏月,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#如何實現中文日歷Calendar”的內容了,經過本文的學習后,相信大家對C#如何實現中文日歷Calendar這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。