I know that I can figure out today's date by [NSDate date]; but how would I find out today day of the week, like Saturday, Friday etc.
I know that %w can be used in NSDateFormatter, but I don't know to use it.
I know that I can figure out today's date by [NSDate date]; but how would I find out today day of the week, like Saturday, Friday etc.
I know that %w can be used in NSDateFormatter, but I don't know to use it.
NSCalendar* cal = [NSCalendar currentCalendar];
NSDateComponents* comp = [cal components:NSWeekdayCalendarUnit fromDate:[NSDate date]];
return [comp weekday]; // 1 = Sunday, 2 = Monday, etc.
I took this further to allow displaying day of the week as a string. Check this link: