How to compare two dates in iphone?

后端 未结 6 1236
渐次进展
渐次进展 2020-12-22 09:50

I want to compare the todays date and other date coming from my database. For example, 2011-03-25 compare it with 2011-02-25

How can i formate my database date as t

6条回答
  •  清酒与你
    2020-12-22 10:30

    NSDate *date1 = [NSDate date];
    NSDate *date2 = [NSDate date];
    
    if ([date1 compare: date2]==NSOrderedAscending) {
        NSLog(@"YES");
    }
    

提交回复
热议问题