am/pm time to 24 hour format
Just convert it to a date using NSDateFormatter and the “h:mm a” format and convert it back to a string using the “HH:mm” format. Check out this date formatting guide to familiarize yourself with this material. let dateAsString = “6:35 PM” let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = “h:mm a” dateFormatter.locale = Locale(identifier: “en_US_POSIX”) // fixes … Read more