2 Replies Latest reply: Jul 15, 2013 6:30 PM by Frank Caggiano
Mike200 Level 1 Level 1 (0 points)

Hi, should I be able to compare NSDate object simply by using < > operators ?

 

i.e. todays date > yesterdays date would equal true


MacBook Air (13-INCH, MID 2011)
  • 1. Re: date comparisons
    xnav Level 5 Level 5 (6,630 points)

    No, use the NSDate compare methods.

    Screen Shot 2013-07-15 at 10.35.10 AM, Jul 15.jpg

  • 2. Re: date comparisons
    Frank Caggiano Level 7 Level 7 (23,865 points)

    Be aware that NSDate objects contain the date AND time so two NSDate objects will only be the same if the date and time are idential (down to sub-second granularity).

     

    If you are really interested in the date only you will have to play some games before doing the comparison.