I am using a date formatter string in order to get the current date as follows:
NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
dateFormatter.dateFormat = @"EEEE / dd-MM-yyyy";
timeLabel.text = [dateFormatter stringFromDate:[NSDate date]];
Now i need to decrement the date by 1 on a button press, If the the date today is Friday/05-08-2011, then on button press it should display Thursday/04-08-2011.
How can i achieve this ?
Code like this (in addition to above answer)
- dateByAddingTimeInterval:available in 4.0 and later, you can use- addTimeIntervalfor lower version (deprecated in 4.0 or later).