How to get the value of NSDate Compare?

Discussion in 'iOS Programming' started by Karlsson87, Mar 5, 2010.

  1. Karlsson87 macrumors newbie

    Joined:
    Mar 5, 2010
    #1
    Hi,


    i compare 2 dates with NSComparisonResult. If one of the date is in the past, now or in the future i get with NSOrderedDescending, NSOrderedSame etc.

    But i need the value of NSComparisonResult, because i have to know how many days are between the dates.

    Does anybody knows how to get the value?


    Thanks,


    Flo
     
  2. bredell macrumors regular

    Joined:
    Mar 30, 2008
    Location:
    Uppsala, Sweden
    #2
    Convert the two dates into numbers using the timeIntervalSinceReferenceDate method. Then you can simply subtract them to get the difference measured in seconds.
     
  3. Karlsson87 thread starter macrumors newbie

    Joined:
    Mar 5, 2010

Share This Page