//将date时间戳转变成时间字符串 [email protected] date 用于转换的时间 [email protected] formatString 时间格式(yyyy-MM-dd HH:mm:ss) [email protected] NSString 返回字字符如(2012-8-8 11:11:11) + (NSString *)getDateStringWithDate:(NSDate *)date DateFormat:(NSString *)formatString { NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:formatString]; NSString *dateString = [dateFormat stringFromDate:date]; NSLog(@"date: %@", dateString); [dateFormat release]; return dateString; }
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/5239.html