• 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: Finding a relative date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding a relative date


  • Subject: Re: Finding a relative date
  • From: Deborah Goldsmith <email@hidden>
  • Date: Mon, 25 Feb 2008 15:49:50 -0800

Please don't use NSCalendarDate, as it only supports the Gregorian calendar. Please use NSCalendar instead, unless you still need to run on 10.3.x.

Deborah Goldsmith
Apple Inc.
email@hidden

On Feb 25, 2008, at 11:39 AM, Nir Soffer wrote:


On Feb 25, 2008, at 21:27, Randall Meadows wrote:

Given a specific NSDate, I need to be able to find, say, the Sunday before that date, or the Saturday after that date. I was hoping to be able to use +dateWithNaturalLanguage with something like "Sunday before [myDate description]", but that just returns myDate.

I know I can brute-force it, by figuring out the myDate's day, then walking backward and/or forward, but is there an easier way? One more tried and true, less error-prone, that's calendar-savvy (not that I'm going to need to go as far back as Oct 1582...)?

Check NSCalendarDate -dayOfWeek and - dateByAddingYears:months:days:hours:minutes:seconds:


Best Regards,

Nir Soffer

_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Finding a relative date
      • From: Paul Bruneau <email@hidden>
References: 
 >Finding a relative date (From: Randall Meadows <email@hidden>)
 >Re: Finding a relative date (From: Nir Soffer <email@hidden>)

  • Prev by Date: Re: NSTreeController with Garbage Collection without CoreData causes problems
  • Next by Date: Re: NSBorderlessWindowMask and NSResizableWindowMask
  • Previous by thread: Re: Finding a relative date
  • Next by thread: Re: Finding a relative date
  • Index(es):
    • Date
    • Thread