现在的位置: 首页 > 综合 > 正文

获得系统所有时区

2013年03月21日 ⁄ 综合 ⁄ 共 437字 ⁄ 字号 评论关闭

 

NSDate *nowDate = [NSDate new];

NSDateFormatter *formatter =  [[NSDateFormatter allocinit];

[formatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"];

//获取所有的时区名字

NSArray *array = [NSTimeZone knownTimeZoneNames];

// NSLog(@"array:%@",array);

//快速枚举法

for(NSString *timeZoneName in array){

[formatter setTimeZone:[NSTimeZone timeZoneWithName:timeZoneName]];

NSLog(@"%@,%@",timeZoneName,[formatter stringFromDate:nowDate]);

}

[formatter release];

[nowDate release];

 

抱歉!评论已关闭.