Possible Duplicate:
How do I get the day of the week in Objective-C?
I have a uilabel that is connected to a nsstring. However, I am trying to set the nsstring to the day of the week (monday, tuesday, etc.). Every time I run it though, it gives me nothing. I have a feeling though that it is because I am not getting a value from my nsdate. However, I'm new to xcode, so I don't really know understand what I've done wrong.
-(void)viewDidLoad {
NSDate *today = [[NSDate alloc] init];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
// Get the weekday component of the current date
NSDateComponents *weekdayComponents = [gregorian components:NSWeekdayCalendarUnit
fromDate:today];
NSString *dateString = weekdayComponents;
_label.text = dateString;
}