I am using below code, but it gives me one day ahead date .

**Example**: passing input string as "*2013-08-31T23:59:59-0400*" and out put date is coming as "*2013-09-01 03:59:59 +0000*".

```
NSDateFormatter *formatter = [self railsDateFormatter];
NSDate *date = [formatter dateFromString:dateString];

+(NSDateFormatter*)railsDateFormatter
{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssZ"];
    NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
    [formatter setLocale:locale];
    return formatter;
}

```

Thank you .