Published
- 1 min read
date formatter swift
The solution for this is noted below
date formatter swift
Solution
func getTimeStampDateString() -> String {
let date = Date(timeIntervalSinceNow: self.doubleValue)
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone(abbreviation: "GMT")
dateFormatter.locale = NSLocale.current
dateFormatter.dateFormat = "d MMM HH:mm:ss"
let strDate = dateFormatter.string(from: date)
return strDate
}
Try other methods by searching on the site. That is if this doesn’t work