//获取当前时间(时分秒毫秒)
+ (NSString *)currentTime
{
NSDate * currentDate = [NSDate date];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"YYYY/MM/dd hh:mm:ss SS"];
NSString * dateString = [dateFormatter stringFromDate:currentDate];
return dateString;
}
对时间戳的转换
+ (NSString *)processingTimeStampWithTimeInterval:(NSString *)timeInterval
{
NSTimeInterval _interval = [timeInterval doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
NSDateFormatter * objDateformat = [[NSDateFormatter alloc] init];
[objDateformat setDateFormat:@"yyyy年MM月dd日 HH:mm"];
return [objDateformat stringFromDate:date];
}
网友评论