简体   繁体   中英

SwiftDate - string to date

I use the SwiftDate library but I can't transform my string to date. This code return null

 let date = "Tue, 19 Sep 2017 15:43:57 GMT".date(format: .custom("EEE, dd MMM yyyy HH:mm:ss zzz"))

Would anyone know why?

This code works now :

let region = Region(tz: TimeZoneName.gmt, cal: CalendarName.gregorian, loc: LocaleName.englishUnitedStates)
let date = "Tue, 19 Sep 2017 15:43:57 GMT".date(format: .custom("EEE, dd MMM yyyy HH:mm:ss zzz"), fromRegion: region)

Thank you for your help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM