Use this,
NSTimeInterval timeInMiliseconds = [[NSDate date] timeIntervalSince1970];
To change it back,
NSDate* date = [NSDate dateWithTimeIntervalSince1970:timeInMiliseconds];
As per apple documentation,
NSTimeInterval: Used to specify a time interval, in seconds.
typedef double NSTimeInterval;
It is of type double.
To convert a date to string,
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
//Optionally for time zone converstions
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"..."]];
NSString *stringFromDate = [formatter stringFromDate:myNSDateInstance];
[formatter release];