I set a Date with 'DateFromComponents" and when I read it out... its wrong. I have to set the DAY to the 2nd or anything later so I get the right Year?!? I set year 2011 and when I read it out i get Year 2010 !!
day = 1;
month = 1;
year = 2011;
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setDay:day];
[components setMonth:month];
[components setYear:year];
NSDate *date = [gregorian dateFromComponents:components];
[gregorian release];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"DD MMMM YYYY"];
NSLog (@"hmm: %@",[dateFormatter stringFromDate:actDate]);
------- Here I get 1 January 2010 /// 2010 not 2011
!?!?
how to fix that.
thx chris