swift – 國曆轉農曆
let dateAt: String = “2016/1/1”
let dateFormatter: NSDateFormatter = NSDateFormatter()
dateFormatter.dateFormat = “yyyy/MM/dd”
let dateComps: NSDateComponents = NSCalendar(calendarIdentifier: NSCalendarIdentifierChinese)!.components([.Year, .Month, .Day], fromDate: dateFormatter.dateFromString(dateAt)!)
print(“\(dateAt) => Chinese calendar date (Lunar): \(dateComps.month)/\(dateComps.day)”)