類方法:
//時間戳轉字符串
+(NSString *)getTimeString:(long int)time;
//時間戳轉字符串
+(NSString *)getTimeString:(long int)time
{
NSTimeInterval timeInterval = time + 28800;
NSDate * date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
//設定時間格式,這裏可以設置成自己需要的格式
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString * dateStr = [dateFormatter stringFromDate:date];
return dateStr;
}