DateFormatter and TimeZone - Swift 3

In Swfit 3, NSDateFormatter has been renamed to DateFormatter. Also, you can no longer use the initializers for TimeZone (i.e. TimeZone(abbreviation: "UTC")).


The documentation for DataFormatter.timeZone states that it is an NSTimeZone and Swift 3 will let you instantiate an NSTimeZone; but won't let you assign it to that memver of the DateFormatter. It says it wants a TimeZone.


If I do the following, I get the error "Cannot assign value of type TimeZone to TimeZone!"


let timeZone : TimeZone = TimeZone.utc
dateFormatter.timeZone = timeZone
DateFormatter and TimeZone - Swift 3
 
 
Q