I have a String is this format:
2017-10-09 13:28:36 +0000
"M/dd/yyyy hh:mm:ss a"
I would like to present dates like so:
Mon Oct 9th
"EEEE, MMM d, h:mm a"
Should I just Calendar Components to construct the date or is there a way to use DateFormatter?
I currently download JSON that contains User "Checkins" and the time they checkedin:
if let dateTime = dict["dateTime"] as? String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "M/dd/yyyy hh:mm:ss a"
dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
let myDate = dateFormatter.date(from: dateTime)!
print(myDate) // 2017-10-09 13:28:36 +0000
// dateFormatter.dateFormat = "EEEE, MMM d, h:mm a" Desired Date Format
checkinObject.dateTime = myDate
}