5
A
Odpowiedz
15
Oto jeden ze sposobów, aby to zrobić:
NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
[components setDay:-1];
NSDate *yesterday = [[NSCalendar currentCalendar] dateByAddingComponents:components toDate:[NSDate date] options:0];
Spójrz na Date and Time programming guide.
http://stackoverflow.com/questions/1889164/get-nsdate-today-yesterday-t-wee-last-week-this-month-last-month-vari –