iOS 判断当前是否是美股交易时间
作者:
pokeey | 来源:发表于
2018-10-22 00:44 被阅读0次+ (BOOL)currentInUSDealing {
NSDate *today = [NSDate date];
NSTimeZone *est = [NSTimeZone timeZoneForSecondsFromGMT:-5 * 3600];
NSCalendar *claendar = [NSCalendar currentCalendar];
claendar.timeZone = est;
if ([claendar isDateInWeekend:today]) {
return NO;
}
NSDateFormatter *formater = [[NSDateFormatter alloc] init];
[formater setDateFormat:@"HH:mm:ss"];
[formater setTimeZone:est];
NSString *todayStr = [formater stringFromDate:today];
NSString *startTimeStr = @"09:30:00";
NSString *endTimeStr = @"16:00:00";
return ([todayStr compare:startTimeStr] != kCFCompareLessThan) && ([todayStr compare:endTimeStr] != kCFCompareGreaterThan);
}
本文标题:iOS 判断当前是否是美股交易时间
本文链接:https://www.haomeiwen.com/subject/moqwzftx.html
网友评论