I want get day component from localDate, [NSDate localDate] just transform the GMT into local time.

```
NSDate *localDate=[NSDate localDate];

// localDate:2017-03-13 18:35:35 +0000
NSLog(@"localDate:%@",localDate);
NSInteger dayComponentLocal=[[NSCalendar currentCalendar] component:(NSCalendarUnitDay) fromDate:localDate];
NSLog(@"dayComponentLocal:%ld",(long)dayComponentLocal);

```

But why the output is 14?

There is the implement of [NSDate localDate]:

```
NSDate *date=[NSDate date];
NSTimeZone *zone=[NSTimeZone systemTimeZone];
NSInteger interval=[zone secondsFromGMTForDate:date];
NSDate *localDate=[date dateByAddingTimeInterval:interval];
return localDate; 

```

And there is another error when I want to get the first weekday of current month, there is the code:

```
NSDate *date=[NSDate localDate];
NSInteger dayComponents=[[NSCalendar currentCalendar] component:(NSCalendarUnitDay) fromDate:date];
NSInteger secondsInADay=24*60*60;
NSDate *firstDay=[date dateByAddingTimeInterval:-((dayComponents-1)*secondsInADay)];
NSInteger weekdayComponent=[[NSCalendar currentCalendar] component:(NSCalendarUnitWeekday) fromDate:firstDay];
NSLog(@"firstDay:%@",firstDay);
NSLog(@"weekday Of firstDay:%ld",weekdayComponent);

```

due to the wrong dayComponents, I subtract one more day from 'localDate' and get the wrong firstDay '2017-02-28 20:09:32 +0000' rather than the correct answer '2017-03-01 20:09:32 +0000'. 2-28 is Tuesday, but I get 4, which means Wednesday,
Why?