Turn off 24-hour clock in settings DateFormatter When using HH format without setting Locale, it is provided in AA H format. Please explain why it works like this
After setting the 12-hour clock, a different DateFormatter is provided.
The underlying reason for this complex.
Most folks who run into this issue do so because they’re trying to use DateFormatter
to deal with fixed-format dates. Is that what you’re doing here?
If so, you must pin the locale to en_US_POSIX
. This is covered in the official docs but QA1480 NSDateFormatter and Internet Dates has all the details.
If you’re hitting this in some other context, please provide us with more details about that context.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"