I am working on a historical application, so I need to deal with the date before and after JC.
I am trying to parse a string with the form "01/01 / -200", but it returns a null date while it works with "01/01/200".
Here is my code:
NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc]init] autorelease];
[dateFormatter setDateFormat:@"dd/MM/y"];
[dateFormatter setLenient:NO];
NSDate* date = [dateFormatter dateFromString:dateString];
return date;
I am also trying to use the form "01/01/200 BC" setDateFormat:@"dd/MM/y G", but I cannot get it to work. As mvds suggests in my answer, I tried the “01/01/200 BC” format on the simulator and it works ... the problem only occurs on my iPad (version 3.2.1)
Do you have an idea how to do it right?
source
share