最近在做一个自娱自乐的小项目的时候遇到了一个问题。
我需要在程序中获取当前的农历日期,查了.net文档后找到了一个叫ChineseLunisolarCalendar的类,可以把把当前的公历日期转化为农历日期。
ChineseLunisolarCalendar类下面有一个int GetMonth(DateTime time)的方法,可以返回给定日期的农历月份,返回值是一个1到13之间的整数。但是在调用这个函数的时候总是报错。
控制台的错误反馈如下:
Exception: GetMonth
System.Globalization.CCEastAsianLunisolarCalendar.GetMonth (DateTime date) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs:1929)
System.Globalization.EastAsianLunisolarCalendar.GetMonth (DateTime time) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Globalization/EastAsianLunisolarCalendar.cs:159)
Honoka.Start () (at Assets/Scripts/Honoka.cs:71)
不知道有没有同样遇到这个问题的人?
我需要在程序中获取当前的农历日期,查了.net文档后找到了一个叫ChineseLunisolarCalendar的类,可以把把当前的公历日期转化为农历日期。
ChineseLunisolarCalendar类下面有一个int GetMonth(DateTime time)的方法,可以返回给定日期的农历月份,返回值是一个1到13之间的整数。但是在调用这个函数的时候总是报错。
控制台的错误反馈如下:
Exception: GetMonth
System.Globalization.CCEastAsianLunisolarCalendar.GetMonth (DateTime date) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs:1929)
System.Globalization.EastAsianLunisolarCalendar.GetMonth (DateTime time) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Globalization/EastAsianLunisolarCalendar.cs:159)
Honoka.Start () (at Assets/Scripts/Honoka.cs:71)
不知道有没有同样遇到这个问题的人?