我需要获取当前位置的时区,例如-5或+3等等。我无法这样做。我正在使用datecomponents:
// Turn the date into Integers
NSInteger year = [dateComponents year];
NSInteger month = [dateComponents month];
NSInteger day = [dateComponents day];
答案 0 :(得分:6)
NSDateFormatter *date_formater=[[NSDateFormatter alloc]init];
[date_formater setDateFormat:@"Z"];
NSString * tz=[date_formater stringFromDate:[NSDate date]];