• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: adding days
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding days


  • Subject: Re: adding days
  • From: Steve Mills <email@hidden>
  • Date: Fri, 25 Mar 2016 16:02:36 +0000 (GMT)

On Mar 25, 2016, at 10:52 AM, "Gerriet M. Denkmann" <email@hidden> wrote:

Please ignore previous post.

NSDate *nextTh =        [ currentCalendar      dateByAddingUnit:  NSCalendarUnitDay
value: 7
   toDate:  now
options:      NSCalendarWrapComponents
];
NSLog(@“%s now + %zd days = %@",__FUNCTION__, addDay, [self timerStringFor: nextTh]);

prints:
now + 7 days = Tue 01 Mar 2016 22:35:33 +0700 (which is indeed a Tuesday)

But I expected now ( 25. Mar 2016) + 7 days = 1st of April (which is a Friday).

How to make NSCalendar work as intended?

Don't use NSCalendarWrapComponents. 

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >adding days (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Why is the first of March a Tuesday
  • Next by Date: Re: Why is the first of March a Tuesday
  • Previous by thread: adding days
  • Next by thread: How to cancel a print operation?
  • Index(es):
    • Date
    • Thread