In my app, want to get the day (i.e. Sunday, Monday,etc.) from the date.
My code is as follow:
NSDate *currentDate = [NSDat
I have made a small NSDate category that helps you find the weekday name from a date.
It returns the localised string for the names of the weekdays.
Have a look at it. You can use it if you want to.
NKLocalizedWeekday+NSDate
Basically, this is the code you need:
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:NSWeekdayCalendarUnit fromDate:[NSDate date]];
int weekdayNumber = [components weekday];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
NSString *weekdayString = [[formatter weekdaySymbols] objectAtIndex:weekdayNumber - 1];