I have been working on a Calendar App. i am getting date format 2023-08-25T7:07:00 pm which is not parsing in any date format.
Required Output: 2023-08-25T19:07:00
Getting fail with all date formatter Here is the my code snippet
let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'T'hh:mm:ss a" dateFormatter.locale = Locale(identifier: "en_US_POSIX") dateFormatter.timeZone = TimeZone.current if let date = dateFormatter.date(from: dateString) { let formattedDateString = dateFormatter.string(from: date) print(formattedDateString) } else { print("Invalid date format") }
Help me on this.
Here is the iOS version which we are using iOS 16.6 and Region Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.englishUnitedKingdom)