1

嗨,我必须以NSTimeZoneNameStyleShortStandardIST、MST 等形式显示时区,但我无法在下面得到这个是我的 code.o/p 是这样来的,GMT+05:30而不是IST.

NSTimeZone *systimeZone = [NSTimeZone systemTimeZone];
    NSString *timeZoneString = [systimeZone localizedName:NSTimeZoneNameStyleShortStandard locale:[NSLocale currentLocale]];
    if([systimeZone isDaylightSavingTimeForDate:[NSDate date]]){
        timeZoneString = [systimeZone localizedName:NSTimeZoneNameStyleShortDaylightSaving locale:[NSLocale currentLocale]];
    }
 NSLog(@"%@",timeZoneString);

o/p 2013-04-27 04:41:01.679 DJProject[1460:c07] GMT+05:30

4

1 回答 1

0

您正在设置,[NSLocale currentLocale]因此它显示您当前的设备区域设置。

于 2013-04-26T11:25:21.463 回答