title: Get the Day from the date in iOS sdk
body: <p>In my app, want to get the day (i.e. <code>Sunday</code>, <code>Monday</code>,etc.) from the date.</p>
  
  <p>My code is as follow:</p>
  
  <pre><code>NSDate *currentDate = [NSDate date];
      NSCalendar *calendar = [NSCalendar currentCalendar];
  
      //ask for current week
      NSDateComponents *comps = [[NSDateComponents alloc] init];
      comps=[calendar components:NSWeekCalendarUnit|NSYearCalendarUnit fromDate:currentDate];
      //create date on week start
      NSDate* weekstart=[calendar dateFromComponents:comps];
  
      //add 7 days
      NSMutableArray* week=[NSMutableArray arrayWithCapacity:7];
      for (int i=1; i&lt;=7; i++) {
          NSDateComponents *compsToAdd = [[NSDateComponents alloc] init];
          compsToAdd.day=i;
          NSDate *nextDate = [calendar dateByAddingComponents:compsToAdd toDate:weekstart options:0];
          NSLog(@"%@",nextDate);  // date is 2013-06-30 18:30:00 +0000
  
  
  
          NSDateFormatter *myFormatter = [[NSDateFormatter alloc] init];
          [myFormatter setDateFormat:@"EEEE"]; // day, like "Saturday"
          //[myFormatter setDateFormat:@"c"]; // day number, like 7 for saturday
  
          NSString *dayOfWeek = [myFormatter stringFromDate:nextDate];
  </code></pre>
  
  <p><strong>PROBLEM</strong></p>
  
  <pre><code>        NSLog(@"Today is: %@", dayOfWeek);  // Prints Mondays instead of Sunday
      }
  </code></pre>
  
  <p><strong>How can I solve this?</strong></p>