标签:height mil tracking art int div val bsp ack
好像是从ios4.1開始[NSDate date];获取的是GMT时间,这个时间和北京时间相差8个小时。下面代码能够解决问题
- (void)tDate
{
NSDate *date = [NSDatedate];
NSTimeZone *zone = [NSTimeZonesystemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *localeDate = [date dateByAddingTimeInterval: interval];
NSLog(@"%@", localeDate);
}
标签:height mil tracking art int div val bsp ack
原文地址:http://www.cnblogs.com/jhcelue/p/7049936.html