Tag Archives: NSDateFormatter

NSDateFormatter case sensitive trap

Though NSDateFormatter behaves slightly different than documented, the following might even be correct, as strange as it might look (mind the last two lines):
-(void)testNSDateFormatterTrap
{
NSDateFormatter *lower = init] autorelease];
lower.dateFormat = @”yyyy-MM-dd HH:mm:SS ZZZ”;

NSDateFormatter *upper = init] autorelease];

NSDateFormatter & Http Header

Ever tried to get e.g. the “Last-Modified” HTTP response header field into a NSDate object? That’s no real fun, because

this standard formatting isn’t digested by default,
the required format string doesn’t quite work as documented.

Let’s concentrate on “Full Date” according to RFC 1123:
NSString *src = @”Fri, 14 Aug 2009 14:45:31 GMT”;
The NSDateFormatter switched to Unicode …