¡@

Home 

2014/10/15 ¤U¤È 10:07:42

iphone Programming Glossary: dt1

How to compare two date?

http://stackoverflow.com/questions/2199488/how-to-compare-two-date

share improve this question NSDateFormatter df NSDateFormatter alloc init df setDateFormat @ yyyy MM dd NSDate dt1 NSDate alloc init NSDate dt2 NSDate alloc init dt1 df dateFromString @ 2011 02 25 dt2 df dateFromString @ 2011 03 25 NSComparisonResult.. df NSDateFormatter alloc init df setDateFormat @ yyyy MM dd NSDate dt1 NSDate alloc init NSDate dt2 NSDate alloc init dt1 df dateFromString @ 2011 02 25 dt2 df dateFromString @ 2011 03 25 NSComparisonResult result dt1 compare dt2 switch result.. dt2 NSDate alloc init dt1 df dateFromString @ 2011 02 25 dt2 df dateFromString @ 2011 03 25 NSComparisonResult result dt1 compare dt2 switch result case NSOrderedAscending NSLog @ @ is greater than @ dt2 dt1 break case NSOrderedDescending NSLog..