Posts

Post not yet marked as solved
1 Replies
323 Views
I would like to replace my use of DateFormatter with the new date.formatted(_) API but am having some difficulty. For the context of the app in question, it is desirable to use twenty-four hour time regardless of what the user's personal settings are. I have code to do this below: let dateFormatter = DateFormatter() dateFormatter.timeZone = TimeZone.autoupdatingCurrent dateFormatter.dateStyle = .short dateFormatter.timeStyle = .none dateFormatter.dateFormat = "\(dateFormatter.dateFormat!) HH:mm:ss" return dateFormatter.string(from: date) Is there a way to do this using the new API or do I need to continue using the old way?
Posted Last updated
.