我想将本地日期转换为 UTC 格式(美国格式)
最佳答案
-(NSString *)getUTCFormateDate:(NSDate *)localDate
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localDate];
[dateFormatter release];
return dateString;
}
关于iphone - 将日期转换为 UTC 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5893449/