I am getting a NSDate *newDate value as 2011-08-12 13:00:00 +0000.
Now when I try to convert it to a string by dateformatter as follows:
NSDateFormatter *dateFormatter= [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd h:mm:ss Z"];
NSString *datestr = [[dateFormatter stringFromDate:newDate] lowercaseString];
But the value which I get for datestr is 5:30 hours more than the newDate value. I don’t know where I am wrong. I get value for datestr as 2011-08-12 18:30:00 + 5:30 (which is incorrect).
It is basically converting the time to your local time zone. if you dont want that just set the time aone for date formatter:
Documentation link:
http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTimeZone_Class/