Issue with 24-hour time format in UIDatePicker and possible workarounds

Dear Apple Support Team,

I am currently developing a control in my app that uses UIDatePicker for time input. To ensure that the time display format is consistently in 24-hour notation regardless of the region, I have set the locale of UIDatePicker to ‘systemLocale’.

However, while this worked as expected up to iPadOS15, displaying the time in 24-hour format, it has switched to a 12-hour format from iPadOS16 onwards. I am wondering if there have been any changes in the behavior of UIDatePicker’s locale between the updates from iPadOS15 to iPadOS16?

Additionally, I would like to know if there are any workarounds to this issue that do not involve modifying the program. In other words, is there a way to revert back to the 24-hour format without changing the code?

Any information you could provide on this issue would be greatly appreciated. Thank you for your assistance.

Answered by DTS Engineer in 798285022

systemLocale would default to 24-hour clock or 12-hour format depending on the user's region setting.

Have you tried using the using locale given by the currentLocale or the autoupdatingCurrentLocale property instead. You might need to specify a different local to UIDatePicker if you prefer a 24-hour clock over a 12-hour clock).

Specify a locale < https://developer.apple.com/documentation/uikit/uidatepicker#2281469 > cover this topic, I would recommend you review the article as well.

systemLocale would default to 24-hour clock or 12-hour format depending on the user's region setting.

Have you tried using the using locale given by the currentLocale or the autoupdatingCurrentLocale property instead. You might need to specify a different local to UIDatePicker if you prefer a 24-hour clock over a 12-hour clock).

Specify a locale < https://developer.apple.com/documentation/uikit/uidatepicker#2281469 > cover this topic, I would recommend you review the article as well.

Thank you for your response.

I understand that using currentLocale or autoupdatingCurrentLocale will display according to the set locale. However, using currentLocale means the behavior depends on the user’s locale settings. I am setting systemLocale to use the 24-hour format for the UIDatePicker value without relying on the user’s locale settings.

Therefore, I would like to know how to solve this issue without changing the code. I believe this issue is due to differences in behavior between iPadOS 15 and iPadOS 16. Until iPadOS 15, it was in the 24-hour format, but from iPadOS 16, it has changed to the 12-hour format. I have not changed the code.

Is there a change in behavior when using systemLocale with UIDatePicker from iPadOS 16?

“systemLocale would default to 24-hour clock or 12-hour format depending on the user’s region setting.” Is it possible to change the region setting to use the 24-hour format?

Thank you in advance for your help.

Issue with 24-hour time format in UIDatePicker and possible workarounds
 
 
Q