title: How to get NSDate start of previous month?
body: <p>I suppose that I ask duplicate question, but I can not find solution for me. I need to get 1st day of the previous month. As I understand I have to get calendar from today, subtract 1 month and set day to be 1st. After that I have to convert to date. Unfortunately I get last day of previous month. </p>
  
  <p>I use following code:</p>
  
  <pre><code>NSDate *maxDate = [[NSDate alloc] init];
  NSCalendar *calendarCurr = [NSCalendar currentCalendar];
  NSDateComponents *components = [calendarCurr components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:maxDate];
  [components setMonth:-1];
  components.day = 1;
  
  NSDate *minDate = [calendarCurr dateFromComponents:components];
  NSLog(@"%@", minDate);
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Yes, it is duplicate, but answers in that question does not help me. I still get 30/09/2014 (when today is 17/11/2014) instead of 01/10/2014. I suppose that my problem is time of todays date.   </p>