Post

Replies

Boosts

Views

Activity

Date and time getting fail to convert in 24 hour, after change format in 12 hour from device setting
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.
2
0
638
Aug ’23