Search code examples
ios7.1nscalendar

How to get the day name in ios


I want to get the name of the day. As an example

If I have a day like 01/08/2014 I want to find 1st is which day Monday,tuesday.....or saturday likewise. How can I do it in iOS. Please help me


Solution

  • Have a look at the NSDateFormatter:

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"EEEE"];
    NSString *dayName = [dateFormatter stringFromDate:yourDate];
    

    More info within apples date formatting guide