ios 时间戳转换成时间

时间戳转换成时间

 1             NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
 2             formatter.timeZone = [NSTimeZone timeZoneWithName:@"shanghai"];
 3             [formatter setDateStyle:NSDateFormatterMediumStyle];
 4             [formatter setTimeStyle:NSDateFormatterShortStyle];
 5             [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
 6             
 7             NSDate* date = [NSDate dateWithTimeIntervalSince1970: [[self.dataDict objectForKey:@"create_time"] integerValue]];
 8             
 9             NSString* dateString = [formatter stringFromDate:date];
10             
11             cell.timeLabel.text = dateString;

 

posted on 2015-09-01 13:33  codemaker313  阅读(520)  评论(0编辑  收藏  举报

导航