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

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -