I am converting project developed in Swift2.3 to Swift3.0 using Xcode8 Beta4. In which I have method to convert date to string, but it fails to convert it.
class func convertDateToString(_ date:Date, dateFormat:String) -> String?
{
let formatter:DateFormatter = DateFormatter();
formatter.dateFormat = dateFormat;
formatter.timeZone = TimeZone.local
let str = formatter.string(from: date);
return str;
}
Also in documentation there is no member named local
.
Is there any way to use TimeZone
directly ? or we have to use NSTimeZone
?