Reputation: 5321
i am trying to convert a RFC3339 formatted String Object to the corresponding NSDateObject :
A received String looks like this : 2012-10-29T00:00:00+01:00
I tried to use a NSDateFormatter but i dont know the correct specifiers ?
Any Ideas how to do this the right way ?
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"yyyy-MM-ddThh:mm:ss???????"]; // ?????
NSDate *date = [dateFormat dateFromString:startAtString];
Upvotes: 0
Views: 513
Reputation: 1333
Inside one of my project I have this routine:
-(NSDate *)convertUTCStringToDate:(NSString *)utcDateString {
NSDateFormatter *df = [[NSDateFormatter alloc]init];
df.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss";
return [df dateFromString:utcDateString];
}
Upvotes: 3