• 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: Calculate next occurrence of a NSDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculate next occurrence of a NSDate


  • Subject: Re: Calculate next occurrence of a NSDate
  • From: Conrad Shultz <email@hidden>
  • Date: Thu, 30 Dec 2010 20:11:55 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Jones wrote:
> Hello,
> I'm trying to calculate next occurrence of a NSDate object. Based on a "Start Date" ( e.g. 2010-12-10, Friday ) I would like to know the date of the next Friday occurrence from today ( e.g. 2010-12-30, Thursday ).
>
> Example:
> StartDate = 2010-12-10
> CurrentDate = 2010-12-30
> Next Occurrence = 2010-12-31 <-Answer
>
> I have not done this before so I'm not sure how to tackle this.

Don't think you can do it (at least easily) with NSDate alone.

See
 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DatesAndTimes/DatesAndTimes.html

and, in particular, the sections on "Calendars, Date Components, and
Calendar Units" and the section on "Calendrical Calculations."

- --
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAk0dWAsACgkQaOlrz5+0JdWqdwCbB1+KN5oBBVITBgwF4dxdgmbr
XVAAmwQYTy+nrpP1kPRHXszfaCu58UvV
=xxLN
-----END PGP SIGNATURE-----
_______________________________________________

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: 
 >Calculate next occurrence of a NSDate (From: Tom Jones <email@hidden>)

  • Prev by Date: Re: Calculate next occurrence of a NSDate
  • Next by Date: NSTableHeaderView, how to clear title before resetting new title
  • Previous by thread: Re: Calculate next occurrence of a NSDate
  • Next by thread: Re: Calculate next occurrence of a NSDate
  • Index(es):
    • Date
    • Thread