I have a code :
NSString *dateStr = [currentElementValue stringByRemovingNewLinesAndWhitespace];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EE, dd MMM yyyy hh:mm:ss ZZ"];
and i am receiving dates from server as string like :
Tue, 08 Jan 2013 13:21:54 +0000
but here’s my problem , when i use : [dateFormat dateFromString:dateStr]
Mon, 07 Jan 2013 10:31:30 +0000 converted to 07-01-2013
but Wed, 02 Jan 2013 15:12:57 +0000
could not be converted.
anyone have any clue why is this happening?
any help would be appreciated. 🙂
This answer describes all the format specifiers in detail.
hhstands for “hour (1-12, zero padded)” – so you can’t write15hhere. If you wish to use a 24-hour time format, useHHinstead.