【发布时间】:2025-12-03 09:35:01
【问题描述】:
我正在做 Objective-c (iOS) 开发。我可以知道如何将 GMT +0 的默认时区更改为 GMT +8。 GMT +8 适用于新加坡。
这是我的代码:
- (IBAction)dateChanged {
NSDate *choice = [datePick date];
NSString *words = [NSString alloc initWithFormat:@"%@", choice];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"You have selected:" message:words delegate:nil cancelButoonTitle:@"OK" otherBUttonTitles:nil, nil];
[alert show];
[alert release];
[words release];
}
谢谢。
【问题讨论】:
标签: iphone objective-c ios timezone gmt