I have an NSDate object and need an integer of the day. i.e. if we have 25th May 2010, the int should be 25. Is there a simple way to do it?
Share
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.
Note that an NSDate is just a timestamp and only has a “day” when considered with respect to a given calendar and time zone. If you want the Gregorian calendar in the current time zone,
If you want the UTC day, set
tz = nil.Also, CFAbsoluteTime and NSDate are (as far as I know) based on POSIX time which specifies a 86400-second day, and thus do not handle leap seconds.