NSDateComponents Archives

How to determine how many days / months / years have passed between two NSDate objects

Imagine you had two NSDate objects and you’d like to find out the time interval between those dates. NSDate objects alone won’t help us out there unless we do some serious NSDateFormatting and hair pulling. Lucky for us there are a few other classes available that will help us do this, namely NSCalendar and NSDateComponents. […]