I’m actually working with fbconnect and I’m trying to get a unix time that represents a month ago. I’m really confused about this since 1970 thing. Cause some body give me a point in the right direction?
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.
With the Unix epoch, time “0” is midnight on January 1st, 1970. Every second since, another second has been added; the time right now as I write this is:
Most systems communicate using the Unix epoch because it is easy, de-facto standard, and allows integer arithmetic. You can get an
NSTimeIntervalrepresenting the duration since the epoch from anNSDatelike this:An NSTimeInterval is just a double. If you want an integer — which I imagine fbconnect needs — just convert it (untested):
Remember, it’s just a count. You can subtract an hour by subtracting 3600 (60 * 60), add a day by adding 86400 (24 * 60 * 60), and so forth; however, it’s better in your case to start with an NSDate representing the specific time you want and allowing the library to do the arithmetic for you.
NSDateis probably just a wrapper around these timestamps.