oc 时间戳格式化

NSString *date = [info objectForKey:@"date"];//获得那个长数字
NSInteger dTime = [date integerValue];
long long lTime = [[NSNumber numberWithInteger:dTime] longLongValue]; // 将double转为long long型

NSString *curTime = [NSString stringWithFormat:@"%llu",lTime]; // 输出long long型
NSDate *time_str =[NSDate dateWithTimeIntervalSince1970:[curTime floatValue]];
NSDateFormatter *date_format_str =[[NSDateFormatter alloc] init];
[date_format_str setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *date_string =[date_format_str stringFromDate:time_str];
此条目发表在ios分类目录。将固定链接加入收藏夹。