iOS 根据时间戳对比现在时间后判断是否在抢购时间内
作者:
WLZero | 来源:发表于
2017-10-09 17:51 被阅读209次-(NSString *)returnIntegralStringData:(NSArray *)activityArr{
//开始时间
NSTimeInterval time1= [activityArr[index][@"apr_stime"] doubleValue];
NSDate *startDate=[NSDate dateWithTimeIntervalSince1970:time1];
//结束时间
NSTimeInterval time2= [activityArr[index][@"apr_etime"] doubleValue];
NSDate *endDate=[NSDate dateWithTimeIntervalSince1970:time2];
//比较时间
if ([startDate timeIntervalSinceNow]>0.0f) {
return @"即将开抢";
}else if ([endDate timeIntervalSinceNow]>0.0f){
return @"抢购中";
}else{
return @"已过抢购时间";
}
return nil;
}
本文标题:iOS 根据时间戳对比现在时间后判断是否在抢购时间内
本文链接:https://www.haomeiwen.com/subject/oympyxtx.html
网友评论