- (NSString *)formateTime:(long long)time
{
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000];//取到秒,此处time单位是毫秒
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
return [formatter stringFromDate:date];
}
网友评论