views:

120

answers:

1

The following code:

NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"MM/dd"];
NSDate *newTime = [dateFormatter dateFromString:@"10/01"];

sets the resulting date to 10/01/1970. Is there a "right" way to have the formatter assume that you mean a date in the current year, or closest to the present date?

A: 

Did you try [dateFormatter setLenient:YES]?

ianh
perfect, don't know how I missed that. Thank you.
Hunter