I need to convert "2013-05-05T00:00:00Z" this string to NSDate and again NSDate to Nsstring. I have tried with different-differnt format style but didn't get any success.
I have already checked.
NSDate from NSString
Convert NSDate to Sql Server Datetime format
Thanks.
// for getting string for Advance search
-(NSDate*) doGetDateFromStringGSearch :(NSString*) dateStr
{
NSDateFormatter * outputFormatter4 = [[[NSDateFormatter alloc ] init ] autorelease ];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[outputFormatter4 setLocale:locale];
//[outputFormatter4 setDateFormat: @"yyyy-MM-dd'T'HH:mm:ss:SSS"];
//[outputFormatter4 setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"];
[ outputFormatter4 setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss:Z" ];
//[ outputFormatter4 setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss':00Z'" ];
NSString * inputString2 = dateStr;
NSDate * inputRecivedToDate = [outputFormatter4 dateFromString:inputString2 ];
NSLog(@"doGetDateFromString %@", inputRecivedToDate);
return [[inputRecivedToDate retain] autorelease];
}