I am taking two NSDates by using date time picker. Now I want to count the number of days between these two NSDates. How can I find the difference between two NSDates.
please give me some solution.
Thanks alot.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NSDate reference is a great little document:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html
is what you are looking for if you want time interval difference.
For days (as not every day has same number of minutes, hours) you want to see Martins answer below and use NSDateComponents with [NSCalendar currentCalendar]