I have the NSDateFormatter
for displaying time as h:mm
to display time as 7:50 PM for example.
It works fine for phones with time showing as 5:55 PM
etc. but there are phones in different countries with time showing on the Status Bar as 05:55 PM and with that setting the NSDateTimeFormatter
with h:mm
seem to return (null).
Are there any workarounds or is there a best way to handle these situations? I was thinking off to check for nil and then retry NSDateFormatter
with hh:mm
but that sounds ugly to me. I wanted to make sure I do it right.
I finally got this to work by converting every date and time using the "en_US_POSIX" locale. I know, it's not truly what I want but it works across different region and time formats. I still have to figure out how to express these dates and times purely based on the user's region and time formats. Maybe, for another day.