iphone - Comparing two NSDates and ignoring the time component -


What is the most efficient / recommended way to compare two NSDates? I would like to be able to see that both dates are the same day, despite the time and have started writing some code, which uses the time interrelationshipset method within the NSDate class and the integer of this value divided by the number of seconds Does one day It seems that it is winding for a long time and I think there is nothing clear to me.

The code I am trying to fix is:

  if (! ([Key comparison: todaydays] == NSOrderedDescending)) {toDaysDateSection = [EventSectionAre Counting] - 1; }  

Where keys and today's days are being created using NSDate objects and nowadays:

  NSDate * todaysDate = [[NSDate alloc] init ];  

Set timings up to 00:00:00 before comparing:
  Unsigned Indsags Flags = NSC AlternatorYure | NSCalendarUnitMonth | NSCalendarUnitDay; NSCalendar * Calendar = [NSCalendar Current Calendar]; NSDateComponents * Component = [Calendar Component: Date to Date: Date]; NSDate * dateOnly = [Calendar DateFormat: Component]; // ... required cleaning  

then you can compare date values. See.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -