iOS时间戳转时间

#pragma mark 时间戳转时间

- (NSString *)dateStr:(NSString *)timeStampStr{

    NSString *timeStampString  = timeStampStr;

    NSTimeInterval interval = [timeStampString doubleValue] / 1000.0;

    NSDate *date  = [NSDate dateWithTimeIntervalSince1970:interval];

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

    [formatter setDateFormat:@"yyyy-MM-dd HH:mm"];

    NSString *dateString = [formatter stringFromDate: date];

    return dateString;

}

你可能感兴趣的:(iOS时间戳转时间)