My date string that I am getting is 2014-01-08T21:21:22.737+05:30 of this format. How do i confer it to NSDate?
I tried:
NSString *currentDate
Your date format contains a time zone as a literal: yyyy-MM-dd'T'HH:mm:ss.SSS+05:30
the +05:30
it the time zone definition. You should parse it with Z
.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
NSString *currentDateString = @"2014-01-08T21:21:22.737+05:30";
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZ"];
NSDate *currentDate = [dateFormatter dateFromString:currentDateString];
NSLog(@"CurrentDate:%@", currentDate);