NSString* dateString = @"2012-04-01T15:37:53Z";
ISO8601DateFormatter *dateFormat = [[ISO8601DateFormatter alloc] init];
[dateFormat setIncludeTime:YES];
NSTimeZone *utcTimeZone = [NSTimeZone timeZoneWithName:@"UTC"];
NSDate* date = [dateFormat dateFromString:dateString timeZone:&utcTimeZone];
STAssertEqualObjects([dateFormat stringFromDate:date timeZone:utcTimeZone], dateString, nil, nil);
The above test fails with
‘2012-04-01T16:37:53Z’ should be equal to ‘2012-04-01T15:37:53Z’
Not sure why the NSString returned by the stringFromDate:date is 1 hour later since both dates are using UTC.
Looks like there is a bug in the #stringFromDate that has been resolved in a fork.