从 NSTimeZone 获取城市和国家
我想(至少)获得时区的国家/地区名称。任何潜在方法都不会提供此信息:
- name,
- localizedName:locale:,
- description
我注意到内置的 iPhone 时钟应用程序可以访问此信息,因为它将伦敦描述为“英国伦敦”。
谢谢。
I'd like to (at least) get the name of the country for a time zone. This is not provided by any of the potential methods:
- name,
- localizedName:locale:,
- description
I notice that the built in iPhone clock App has access to this information, as it describes London as "London, England".
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我确信它与内置时钟的工作方式不同。有一个城市数据库,每个城市都有一个国家和一个时区。
您对
[myGMT city]
有何期望?都柏林还是卡萨布兰卡?I'm sure that it works different with the built-in clock. There is a database of cities of which each has a country and a timezone.
And what would you expect from
[myGMT city]
? Dublin or Casablanca?从
timeZoneWithName:data:
方法,文件系统的时区信息位于/usr/share/zoneinfo
。我不知道文件的格式是什么,或者您是否可以从应用程序沙箱中读取它们,但这可能就是时钟应用程序获取信息的方式。
From the description of the
timeZoneWithName:data:
method, the filesystem has timezone information located at/usr/share/zoneinfo
.I have no idea what the format of the files is, or if you can even read them from the application sandbox, but that's likely how the Clock application gets the information.