• 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: Trouble comparing NSCalendarDates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble comparing NSCalendarDates


  • Subject: Re: Trouble comparing NSCalendarDates
  • From: Tito Ciuro <email@hidden>
  • Date: Mon, 15 Nov 2004 11:14:15 +0100

Hello again,

I think I know what happens...

If I call this:

returnedValue = [NSCalendarDate dateWithString: [NSString stringWithUTF8String: data]];

The proper date is returned... *however*: if you compare both dates, they're still *not* the same. It seems to me that the original date created using [NSCalendarDate date] stores sub-second information. This extra info is not stored to disk, so when we instantiate a new NSCalendarDate object with the above statement, the sub-second information has been lost:


NSTimeInterval interval = [testDataDate timeIntervalSinceDate:verifyDate];
NSLog(@"interval between the two: %f", interval);

shows:

2004-11-15 11:03:18.880 QuickLiteTestRun[2243] interval between the two: 0.872705

So, in order to compare both dates we'll have to do this instead:

[[testDataDate description] isEqualToString: [verifyDate description]];

Is there any way I can store/retrieve to disk all the information belonging to an NSCalendarDate?


Thanks once again,

-- Tito

On Nov 15, 2004, at 10:32, j o a r wrote:

You should probably do:

NSString *dateStr = [NSString stringWithUTF8String: data];
NSCalendarDate *aDate = [NSCalendarDate dateWithString: dateStr calendarFormat: nil];

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Trouble comparing NSCalendarDates
      • From: Darkshadow <email@hidden>
    • Re: Trouble comparing NSCalendarDates
      • From: j o a r <email@hidden>
References: 
 >Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)

  • Prev by Date: Xcode & ANTLR
  • Next by Date: NSImage & colorspace
  • Previous by thread: Re: Trouble comparing NSCalendarDates
  • Next by thread: Re: Trouble comparing NSCalendarDates
  • Index(es):
    • Date
    • Thread