Reputation: 15
I need to convert the following date to epoch timestamp
Wed, 21 May 2014 16:47:00 BST
stringPubDate has the above string stored in it.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE, d MMMM yyyy HH:mm:ss z"];
NSDate *date = [dateFormatter dateFromString:stringPubDate];
Null is being returned when I do this. I need to convert this NSString to NSDate and then convert it into epoch timestamp. Can someone please help me?
Upvotes: 1
Views: 247
Reputation: 535139
The problem is that the date format you are giving does not match the format of the date in the string.
Upvotes: 1