iOS 17 Date Format issue

Has something changed with iOS 17 and the Date Formatter ? I've always used dateFormatterSet.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS" which would always output something like 2023-09-27 16:21:30.392 but since iOS 17 it will output as 2023-09-27 4:21:30.000 PM but i'm not using 12 hour format in the code.

Any suggestions would be appreciated! Thanks.

** UPDATE ** I've noticed this is only happening to a couple users using iOS 17 and I'm trying to figure out if they changed a system setting that is altering the date format code? I've tried to re-produce this issue on my end with physical devices and simulators with no luck. Would anyone have any ideas which setting they can change that might do this?

If your main trouble is with AM/PM vs 24h: iPhone->settings->General->Date & Time-> 24h display on/off. Otherwise it may also be connected to the locale of the user or their Region/language settings.

And yes, NSDateFormatter is painful.

Did you get the solution for this issue? @cwolkowski

Nothing had to be fixed in the code as it seemed to be a device/OS bug. He was using iOS 17 beta with 24 hr time format in his settings when this issue kept happening... Once he upgraded to full version iOS 17.0.2 and did a factory reset everything seemed to start working properly with the timestamps.. @Iyyappanrhaj

Thank you for the Response @cwolkowski .in my case it happened to only 3 users who is already using iOS 17.0.3.Do you have any suggestions?

This issue still occurs in iOS 17.1.1

@a111001 @Iyyappanrhaj - This happened again to a user ... I'm going to try setting the DateFormatter locale to "en_US_POSIX" to see if this resolves it as I've read this fixes other date format issues... I'll keep you posted.

dateFormatterSet.locale = Locale(identifier: "en_US_POSIX")

"timeFormat.isEqual("HH:mm") ? Locale(identifier: "en_GB") : Locale(identifier: "en_US")". // "en_GB" for 24 && "en_US" for 12 hour time formats

I used above code its work properly but when i set device region is unitedState always show 24 hour time format in DateTimePicker , this issue occurred above iOS 17 versions, anyone face this issue? please provide a propper solution

iOS 17 Date Format issue
 
 
Q