1
日付文字列のためたDateFormatter(NSDateFormattter)をフォーマットする方法日付文字列の次のためにフォーマッタ(NSFormatter)を構築する方法
Date dateString = "Sun Oct 30 2016 00:00:00 GMT+0530 (IST)"
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "E MMM d yyyy HH:mm:ss" // This line is not working
let dd: Date? = dateFormatter.date(from: dateString)
print("Date \(dd)") // Is returning null
APIリファレンス:私はあなたがするDateFormatter
を伝える必要があるでしょうと思います https://developer.apple.com/reference/foundation/dateformatter
あなたの日付文字列の一部である 'dateFormat'では、あなたはアカウントに入っていません:' GMT + 0530(IST) '。ですから、 'dd'はゼロです。 – Larme
GMT +0530(IST)を表す方法を教えてください。 – Helloworld
「GMT + 0530」をご覧ください:http://www.unicode.org/reports/tr35/tr35 -31/tr35-dates.html#Date_Format_Patterns – Larme