我如何在iOS上获得昨天的NSDate?
由于
答案 0 :(得分:15)
这是一种方法:
NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
[components setDay:-1];
NSDate *yesterday = [[NSCalendar currentCalendar] dateByAddingComponents:components toDate:[NSDate date] options:0];