Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Labeno

macrumors 6502
Original poster
Jul 21, 2008
351
1,089
Hey all,
Is there an iPhone API to determine if the iPhone is set to 12 or 24 time mode?
I want my apps to print time according to the iPhone system settings.
Thanks.
 

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
Hey all,
Is there an iPhone API to determine if the iPhone is set to 12 or 24 time mode?
I want my apps to print time according to the iPhone system settings.
Thanks.

You will want to use an NSDateFormatter, which respects the system date and time formats.
 

123321

macrumors newbie
Dec 24, 2008
7
0
Determining 12 or 24 hour time

I need to determine 12 or 24 hour time for puproses other than printing time. NSDateFormatter cannot answer directly, so I need some other way. How can I deal with that task?
 

Pring

macrumors 6502
Sep 17, 2003
310
0
You can't, there's no API calls available to determine that. Make it a user preference in Settings.app if it's that important to your app.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Kind of ugly, but you could create a date of today at 1:00 PM and then get the string value from NSDateFormatter. If it's 13:00 then you know it's 24-hour. The value could then be cached so you only do it once.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.