Tag: nzonezone

iOS的 – 如何获得时区的原始偏移量?

如何以编程方式获取iOS中协调世界时的原始偏移量(以毫秒为单位)?

将时区名称转换为Xcode中的Time ID:s

我发现iOS框架不能理解适当的时区名称,如“东部标准时间”,如果input: NSLog(@"EST: %@", [NSTimeZone timeZoneWithName:@"Eastern Standard Time"]); … 你得到: EST:(null) 相反,您必须使用时间ID:s(较窄的区域),例如“America / New_York” NSLog(@"EST: %@", [NSTimeZone timeZoneWithName:@"America/New_York"]); 然后在Xcode中的控制台好心回应: EST:America / New_York(GMT-4)胶印-14400(日光) 有没有办法将时区名称翻译成时间ID:S? 因为我使用的web-API给我的时区名称,而不是时间ID:s。

如何将UTCdatestring转换为本地时间(systemTimeZone)

inputstring:2012年6月14日 – 01:00:00 UTC 输出本地string:2012年6月13日 – 21:00:00 EDT 我喜欢从中获得抵消 NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone]; NSLog(@"Time Zone: %@", destinationTimeZone.abbreviation); 任何build议?