• 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: NSCalendarDate Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCalendarDate Questions


  • Subject: Re: NSCalendarDate Questions
  • From: Larry Fransson <email@hidden>
  • Date: Thu, 3 Jun 2004 18:49:44 -0700

On Jun 3, 2004, at 15:50, Rhon Fitzwater wrote:

Okay, so here is what I want to do:

- write to a file the current date via NSCalendarDate

- read the date written to a file and compare it against the current
date
- have the comparison return the difference in days

// Is below how I set the current date
NSCalendarDate *now = [NSCalendarDate calendarDate];

That's how you do it.

At startup, I check first to see if there is a valid serial number. If no valid serial number, I check for existence of the invisible file that has the first launch date in it. If it does not exist, I put the current date into a dictionary and write the dictionary to a file. If the file does exist, I read the dictionary from the file and compare the date in the dictionary to today's date.

The docs for NSDictionary and NSCalendarDate contain all of the information you need to perform the operations I just listed.

Larry Fransson
Seattle, WA
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSCalendarDate Questions (From: Rhon Fitzwater <email@hidden>)

  • Prev by Date: Cocoa binding problem/bug - setKeys not inherited?
  • Next by Date: Re: Fwd: World-Wide (ish) NeXT Meetups
  • Previous by thread: NSCalendarDate Questions
  • Next by thread: Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
  • Index(es):
    • Date
    • Thread