Post

Replies

Boosts

Views

Activity

Reply to Date format giving wrong year
static func stringtoDateConverter(startDateString : String) -> Date { // create date from string let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'" dateFormatter.timeZone = NSTimeZone.local dateFormatter.timeZone = NSTimeZone(name: "UTC") as TimeZone? let startDate = dateFormatter.date(from: startDateString)// create date from strinG return startDate! }``` This is the code for the above function call.
Jan ’24