首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

获取环球所有时区当前时间

2012-08-07 
获取全球所有时区当前时间NSDate?*nowDate [NSDatenew]NSDateFormatter?*formatter? [[NSDateFormatte

获取全球所有时区当前时间

NSDate?*nowDate = [NSDatenew];

NSDateFormatter?*formatter=? [[NSDateFormatter?alloc]init];

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

NSArray?*array = [NSTimeZoneknownTimeZoneNames];

//快速枚举法

for(NSString?*timeZoneNamein?array){

[formattersetTimeZone:[NSTimeZonetimeZoneWithName:timeZoneName]];

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

}

[formatterrelease];

[nowDaterelease];

热点排行