IOS根据时间戳获取时间字符串
2016-09-03 本文已影响54人
蜗牛1992
+ (NSString *)GetCurrentTimeDate:(long64)iDenty{
NSDate *pDate = [NSDate dateWithTimeIntervalSince1970:(iDenty)/1000];
NSDateFormatter *pFormatter = [[NSDateFormatter alloc]init];
[pFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
return [pFormatter stringFromDate:pDate];
}
//精确到秒
+ (NSString *)GetCurrentTimeDate2:(long64)iDenty{
NSDate *pDate = [NSDate dateWithTimeIntervalSince1970:(iDenty)/1000];
NSDateFormatter *pFormatter = [[NSDateFormatter alloc]init];
[pFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
return [pFormatter stringFromDate:pDate];
}