I have the following timestamp:
which I need to convert into a Unix Timestamp. I have the following code:
But this returns 0. I feel the issue may lie where I set the date format, but I'm not sure what to replace this with. Any ideas?
Code:
Wed May 05 22:52:51 +0000 2007
which I need to convert into a Unix Timestamp. I have the following code:
Code:
NSString *time = timestamp.text;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"aaa bbb dd HH:MM:SS zzzz YYYY"];
NSDate *myDate = [df dateFromString:time];
NSTimeInterval unixInterval = [myDate timeIntervalSinceDate:[NSDate dateWithNaturalLanguageString:@"01/01/1970"]];
result.text = [[NSString alloc] initWithFormat:@"%0.0f",unixInterval];
But this returns 0. I feel the issue may lie where I set the date format, but I'm not sure what to replace this with. Any ideas?