Reputation: 399
I'm trying to get a label to show the date in the format of (Month) XX, XXXX
Using:
currentDate = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setTimeStyle:NSDateFormatterShortStyle];
date.text = [dateFormat stringFromDate:currentDate];
Unfortunately, the label text doesn't even change, what am I doing wrong?
Upvotes: 0
Views: 532
Reputation: 5384
Try this
first you have set IBOutlet connection date label
NSDate *currentDate = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM YYYY"];
date.text = [dateFormat stringFromDate:currentDate]
Upvotes: 1