Formatted dates that I am passing to an instance method are not saving/printing the correct date. Can someone please help?
Calling method code snippets:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"dd-mm-yyyy"];
[requests addObject:[[Request alloc] initWithDueDate:(NSDate *) [dateFormatter dateFromString:@"13-09-2011"]]];
Receiving method code snippets:
dueDate = dd;
NSLog(@"Due Date: %@", dueDate);
Console output:
Due Date: 2011-01-12 13:09:00 +0000
You have to check your formatting string. It follows these official formats.
Small
mis for minute, capMfor the month.