Posts

Showing posts from March 17, 2019

Converting UTC time in Swift

Image
2 I'm trying to use an API in a practice project and one of the values in the JSON, dateTimeLocal , is a date & time in UTC format. In my cellForRowAt method I put the date/time into a label: override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "eventsCell", for: indexPath) as! EventsTableViewCell let event = eventData[indexPath.row] cell.eventTimeLabel.text = event.dateTimeLocal return cell } And this prints out the date and time as: 2018-11-26T19:00:00 I'd like to get this date and time in a format that reads, using the above date/time as an example, November 26, 2018 @ 7:00pm Is this possible or will I have to include the date and time in t...