以下代码显示了问题:从1435年的第一天开始整整一年不会导致1436年的第一天.
我缺少什么想法?
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setDay:1];
[components setMonth:1];
[components setYear:1435];
NSCalendar *islamic = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCalendar];
NSDate *date = [islamic dateFromComponents:components];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setCalendar:islamic];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSLog(@"%@", [dateFormatter stringFromDate:date]); // -> 01.01.1435
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setYear:1];
NSDate *dateWithOffset = [islamic dateByAddingComponents:offsetComponents toDate:date options:0];
NSLog(@"%@", [dateFormatter stringFromDate:dateWithOffset]);
// -> 30.12.1435 ... WHY NOT 01.01.1436 ????
Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以写出方差公式,使其始终与方差大于阈值的最新像元相关?
在下表中,如果变化的绝对值大于10%,则百分比的分母会更改。我手动更改了公式。
------------------------------------------
| Row | Value | Variation| Formula |
------------------------------------------
| 1 | 1,1608 | 0,0% | A2/ A$2 - 1 |
| 2 | 1,1208 | -3,4% | A3/ A$2 - 1 |
| 3 | 1,0883 | -6,2% | A4/ A$2 - 1 |
| 4 | 1,0704 | -7,8% | A5/ A$2 - 1 |
| 5 | 1,0628 | -8,4% | A6/ A$2 - 1 |
| 6 | 1,0378 | -10,6% | A7/ …Run Code Online (Sandbox Code Playgroud)