In my app, I am getting two dates.
For Example,
1st Date : 28-10-2011
2nd Date : 2-11-2011
Now I want to all dates between this two selected date.
So it should be,
28-10-2011
29-10-2011
30-10-2011
1-11-2011
2-11-2011
How can I get this using NSDate?
You can convert your strings to NSDate objects using NSDateFormatter, then use NSDate's ealierDate: and laterDate: methods to compare them.
try
dateWithTimeInterval:SinceDate:
Look at
NSDateComponents
anddateByAddingComponents:toDate:options:
, this is what I use and it works pretty good. Make sure to watch out for years that are leap years.UPDATE: I would use thomas's example. It works better than mine and it is a lot easier to read.