//时间格式
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MMM dd,yyyy HH:mm tt"];
//时间字符串NSDate
NSDate *date = [formatter dateFromString:string];
//NSDate转时间字符串
NSString *dateString = [formatter stringFromDate:date];
//时间转时间戳
NSTimeInterval interval = [date timeIntervalSince1970];
//时间戳转时间
date = [NSDate dateWithTimeIntervalSince1970:interval];
时间: 2024-10-07 01:21:03