Reputation: 1073
I have implemented a calendar application for iPhone.
I am getting the current date using [NSDate date]
.
Now I want to display only "Tuesday". So how can I get this output. I don't know which format I have to use.
Thanks.
Upvotes: 1
Views: 511
Reputation: 2074
You need NSDateFormatter.
NSDateFormatter *dayFormat = [[NSDateFormatter alloc] init];
[dayFormat setDateFormat:@"EEEE"];
NSDate *now = [[NSDate alloc] init];
NSString *formattedDay = [dayFormat stringFromDate:now];
See the Unicode reference for all of the format options you can use.
Upvotes: 3