时间格式转换

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    
    NSDate *date =[[[NSDate alloc]initWithTimeIntervalSince1970:[cobj.time doubleValue]]autorelease];    
    //    NSLog(@"%@", date);
    
    
    NSString *strDate = [dateFormatter stringFromDate:date];
    [dateFormatter release];

原文地址:https://www.cnblogs.com/gaoxiao228/p/2614318.html