I get the following date format from my application.
07/18/2011/04/45/EDT
I sub-string that to “07/18/2011/04/45” and “EDT”.
Using the following code I compose a date.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy/HH/mm"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]];
NSDate *currentServerDate = [dateFormatter dateFromString:formattedDateString];
NSLog(@"currentServerDate %@",currentServerDate);
However when I print the NSDate (created using above formattter) it print as “2011-07-18 14:15:00 +0530” where +0530 is my timezone. I need to compose the relative to the EDT timezone. How do I do that?
Thank you
I think the time zone is probably not what you think it is. Try logging the time zone returned by timeZoneWithAbbreviation: and seeing what it tells you. Also, review the documentation I linked to where it says: