标签:
-(NSString*)changeNumToTime:(NSString*)str {
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[str integerValue]/1000];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
NSString *showtime = [dateFormatter stringFromDate:date];
return showtime;
}
eg: str = @"1441047302"时,返回的showtime = @"1970-01-18 00:17:27"。
转化秒数为正规的时间格式{NSString格式的秒数转成NSDate格式后再以NSString形式输出)
标签:
原文地址:http://www.cnblogs.com/yyt-hehe-yyt/p/4832888.html