0

I need to convert this date string to a date object. This is the format that youtube API sends for a published at date.

2022-10-26T02:40:04.645878Z

let all_time_date = "2022-10-26T02:40:04.645878Z"
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let allTimeDate = dateFormatter.date(from: all_time_date)

I get a null value on conversion and do not know if its the .dateFormat that is incorrect

husharoonie
  • 431
  • 1
  • 4
  • 19

0 Answers0