how to get a particular day of week in objective c??
Posted
by hemant
on Stack Overflow
See other posts from Stack Overflow
or by hemant
Published on 2010-04-23T07:51:38Z
Indexed on
2010/04/23
8:03 UTC
Read the original article
Hit count: 235
objective-c
|iphone-sdk
using gregorian calender i am able to get the number of day of the week i.e 1 for sunday and 2 for monday etc but i am not able to find a function that displays the name of week then the number?? can anyone help??
here is my code to get the number of day
NSDate *dates = [gregorian dateFromComponents:component];
NSDateComponents *weekdayComponents =[gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:dates];
NSUInteger *weekdays = [weekdayComponents weekday];
NSString *dayw=[NSString stringWithFormat:@"%1i",weekdays];
NSLog(@"%@",dayw);
© Stack Overflow or respective owner