How to format date using NSDateFormatter iOS?
<p>I tried to use the <code>NSDateFormatter</code> to format a date that selected from a <code>UIDatepicker</code>. But the formatted result giving a <code>nil</code>. </p>

<pre><code>-(NSString *)formatDateWithString:(NSString *)date{ 
    NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.dateFormat = @"yyyy-MMM-dd HH:mm:ss";
    NSDate *formattedDate = [dateFormatter dateFromString:date];
    return [dateFormatter stringFromDate:formattedDate];
}
</code></pre>

<p>date input is <code>2016-04-22 16:30:36 +0000</code>(after selected from UIDatePicker). How may I fix this?</p>