致命錯誤:索引超出範圍withot使用任何陣列時,我使用循環致命錯誤:索引超出範圍,而無需使用任何陣列
func getDayOfWeek(_ today:String) -> String? {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let date = dateFormatter.date(from:today)
let weekDay = dateFormatter.weekdaySymbols[Calendar.current.component(.weekday, from:date!)]
return weekDay
}
告訴你這段代碼 – Tj3n
2017-03-20T04使用日期:13:00Z –
顯示環 –