如何在Windows Phone 7中从日期时间获取中国年份



这是一个使用.Net Framework的简单任务,因为它有ChineseLunisolarCalendar类。中国年可以这样获得:

ChineseLunisolarCalendar calendar = new ChineseLunisolarCalendar();
var someDate = new DateTime(1984,2,1);
var chineseYear = calendar.GetYear(someDate);// will be 1983

Windows手机中是否有类似的结构?

您可以尝试使用项目中所有相关类的Mono实现来填补空白,

https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Globalization/ChineseLunisolarCalendar.cs

最新更新