将Date转换为中国农历
func convertDateToNongLi(aStrDate:Date)-> String{
// MARK: - 农历格式数据
let cDayName = [
"初一", "初二", "初三", "初四", "初五",
"初六", "初七", "初八", "初九", "初十",
"十一", "十二", "十三", "十四", "十五",
"十六", "十七", "十八", "十九", "二十",
"廿一", "廿二", "廿三", "廿四", "廿五",
"廿六", "廿七", "廿八", "廿九", "三十"
]
let cMonName = [
"正", "二", "三", "四", "五",
"六", "七", "八", "九", "十",
"十一", "腊"
]
let calendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.chinese)
guard let m = calendar?.components(.month, from: aStrDate).month else {return ""}
guard let d = calendar?.components(.day, from: aStrDate).day else {return ""}
let mStr = cMonName[m - 1]
let dStr = cDayName[d - 1]
// MARK: - 返回方法自定义去修改
if (d - 1) == 0{
return "\(mStr)月"
}
return "\(dStr)"
}