NSDateFormatter格式化2017年12月31号时间格式为2018年12月31号问题

249 阅读1分钟
+ (NSString *)dateStrWithTimesp:(long long)timesp {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:timesp];
    NSString *dateStr = [formatter stringFromDate:confromTimesp];
    return dateStr;
}