My problem is there is a switch in my app which toggles for 12 hour and 24 hour time format.I am displaying my labels time according to that, but the UIDatePicker
UIDatePicker
There is no need of any single Line of Code. We can set the locale from Story Board also, I have attached the screenshot.
And to do this programmatically we can also write the following code.
dateTimePicker.locale = Locale(identifier: "en_GB")