return nil for dateFromString call of NSDateFormatter
Posted
by tw
on Stack Overflow
See other posts from Stack Overflow
or by tw
Published on 2010-04-05T04:58:55Z
Indexed on
2010/04/05
5:03 UTC
Read the original article
Hit count: 575
nsdateformatter
I am getting nil returned for the date variable in the below code. I can't find any problem with the date format, can anyone help?
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"];
NSString *dateString = [[NSString alloc] initWithFormat:@"%@", @"Mon Apr 05 04:37:28 UTC 2010"]; NSDate *date = [formatter dateFromString:dateString];
© Stack Overflow or respective owner