NSString *str = [NSString stringWithFormat:@"%@", [dic1 objectForKey:@"time"]];//时间戳 这么的原因是服务器返回的time是个nsnumber类型的 ,如果直接是字符串就不用这么转换了
str = [str substringToIndex:10]; // 时间戳一般是10位数,如果服务器返回的是超过10位数时,记得要截取
NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:[str doubleValue]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// 设定时间格式
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *str = [dateFormatter stringFromDate: detaildate];
NSLog(@"%@",s);