IOS 时间格式转换

//时间转换

- (NSString*)getTimeWithString:(NSString*)str{

NSString*time =str;

NSDateFormatter*formatter = [[NSDateFormatteralloc]init];

[formattersetDateStyle:NSDateFormatterMediumStyle];

[formattersetTimeStyle:NSDateFormatterShortStyle];

[formattersetDateFormat:@"YYYY-MM-dd HH:mm"];

NSDate*confromTimesp = [NSDatedateWithTimeIntervalSince1970:(NSTimeInterval)[timeintValue]];

NSString*confromTimespStr = [formatterstringFromDate:confromTimesp];

returnconfromTimespStr;

}

你可能感兴趣的:(IOS 时间格式转换)