Although @lordsandwich's answer is correct, you can also directly use the NSDate timeIntervalSince1970 method instead of creating the 1970 NSDate .
This will work as follows:
NSDate *past = [NSDate date]; NSTimeInterval oldTime = [past timeIntervalSince1970]; NSString *unixTime = [[NSString alloc] initWithFormat:@"%0.0f", oldTime];
As with using this, you do not unnecessarily add a new object to the autorun pool, I think that it is actually better to use this method.
source share