Question: ```
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];

NSDate *date1 =[[NSDate alloc] init];
date1 = [dateFormat dateFromString:@"11-nov-2013"];
NSLog(@"date is %@",date1); // it returns null
self.datePicker.date = date1;
[dateFormat release];

```

Answer: 
```
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd-MMM-yyyy"];
NSDate *myDate = [formatter dateFromString:@"11-nov-2013"];
NSLog(@"date is %@",myDate);

```
Set date format to

```
[dateFormat setDateFormat:@"dd-MM-yyyy"];

```