Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>(Almost the same as <a href="https://stackoverflow.com/questions/181459/is-there-a-better-way-to-find-midnight-tomorrow/181495#181495">this question</a>.)</p> <p>From the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendarDate_Class/Reference/Reference.html" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p>Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release after Mac OS X v10.5. For calendrical calculations, you should use suitable combinations of NSCalendar, NSDate, and NSDateComponents, as described in Calendars in <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/DatesAndTimes/DatesAndTimes.html" rel="nofollow noreferrer">Dates and Times Programming Topics for Cocoa</a>.</p> </blockquote> <p>Following that advice:</p> <pre><code>NSDate *today = [NSDate date]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; components.month = 1; NSDate *nextMonth = [gregorian dateByAddingComponents:components toDate:today options:0]; [components release]; NSDateComponents *nextMonthComponents = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:nextMonth]; NSDateComponents *todayDayComponents = [gregorian components:NSDayCalendarUnit fromDate:today]; nextMonthComponents.day = todayDayComponents.day; NSDate *nextMonthDay = [gregorian dateFromComponents:nextMonthComponents]; [gregorian release]; </code></pre> <p>There may be a more direct or efficient implementation, but this should be accurate and should point in the right direction.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload