作者:乘浪追风2010_210 | 来源:互联网 | 2023-09-25 13:41
获取当前日期(NSString*)getCurrentTimebyday{NSDateFormatter*nsdf2[[NSDateFormatteralloc]init];[n
+(NSString*)getCurrentTimebyday{NSDateFormatter* nsdf2=[[NSDateFormatter alloc] init];[nsdf2 setDateStyle:NSDateFormatterShortStyle];[nsdf2 setDateFormat:@"YYYYMMdd"];return [nsdf2 stringFromDate:[NSDate date]];
}
+(NSString*)getCurrentTimebyseconds
{
NSDateFormatter* nsdf2=[[NSDateFormatter alloc] init];[nsdf2 setDateStyle:NSDateFormatterShortStyle];[nsdf2 setDateFormat:@"YYYYMMddHHmmss"];return [nsdf2 stringFromDate:[NSDate date]];
}
+(NSString *)timespan{NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];NSTimeInterval a=[date timeIntervalSince1970]*1000;NSString *timespan = [NSString stringWithFormat:@"%.0f", a];
return timespan;
}
+ (NSString*) stringWithGUID {CFUUIDRef uuidObj = CFUUIDCreate(nil);NSString *uuidString = (__bridge_transfer NSString*)CFUUIDCreateString(nil, uuidObj);CFRelease(uuidObj);return [uuidString lowercaseString];
}