更改时区
我正在做 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];
}
谢谢。
I'm doing objective-c (iOS) development. May I know how do I go about changing the default time zone of GMT +0 to GMT +8. GMT +8 is for Singapore.
Here is my code:
- (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];
}
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用,
或者,
这将适合您的情况,
You can use,
OR,
Which will be in your case,