Re: Country code or name
Re: Country code or name
- Subject: Re: Country code or name
- From: Tom Harrington <email@hidden>
- Date: Mon, 15 Sep 2003 14:50:43 -0600
On Monday, September 15, 2003, at 12:47 PM, mmalcolm crawford wrote:
On Sep 15, 2003, at 10:48 AM, Chuck Soper wrote:
Is there anyway that I can grab the text in the "System
Preferences:Date & Time:Time Zone" Closest City field? For example,
if the text reads, "New York - U.S.A.", how do I programmatically get
that text from a Cocoa application?
[[NSUserDefaults standardUserDefaults]
arrayForKey:@"com.apple.TimeZonePref.Last_Selected_City"]
I'm not sure of the exact format of the array, but...
Would it be obnoxious to ask if this is documented anywhere?
I get this information:
0 : <CFString 0x9fb80 [0xa01303fc]>{contents = "39.733334"}
1 : <CFString 0x9fbc0 [0xa01303fc]>{contents = "-104.983337"}
2 : <CFString 0x9adc0 [0xa01303fc]>{contents = "4"}
3 : <CFString 0x9fbe0 [0xa01303fc]>{contents = "America/Denver"}
4 : <CFString 0x9c0d0 [0xa01303fc]>{contents = "US"}
5 : <CFString 0x9fba0 [0xa01303fc]>{contents = "Denver"}
6 : <CFString 0x9fc30 [0xa01303fc]>{contents = "U.S.A."}
7 : <CFString 0x9fba0 [0xa01303fc]>{contents = "Denver"}
8 : <CFString 0x9fc30 [0xa01303fc]>{contents = "U.S.A."}
...which is interesting in that it includes longitude and latitude as
well as country. If the nation fields are correct for all zones (and
some spot checking indicates that it probably is), this would be a
simple way to extract country info from time zone.
A simpler way to get the closest city without the rest of the details
would be to use [[NSTimeZone localTimeZone] name], which in my case
returns "America/Denver".
--
Tom Harrington
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.