iPhone Date Comparison

Discussion in 'iOS Programming' started by XcodeNewb, Feb 8, 2009.

  1. XcodeNewb macrumors member

    Joined:
    Feb 6, 2009
    #1
    I would like to compare two dates stored in NSStrings to see if the first date is earlier than the second. I have researched the earlierDate method in NSDate but I am not quite sure how to implent it and how to get the result as a bool ( true/false).

    Any help would be appreciated. Thanks

    NSString *date1;
    NSString *date2;

    date1 holds "11/11/2008" and date2 holds "11/12/2008"

    Is there any if statement I can do?

    if (date1 isEarlierThan(date2))
    {
    return true;
    }

    This is just an example of course. Thanks
     
  2. chbeer macrumors member

    chbeer

    Joined:
    Sep 22, 2008
    Location:
    Berlin

Share This Page