Le 28 avr. 2010 à 05:45, Scott Ribe a écrit : > > It seems as though some calls are using one time zone and some are using > another??? I do not do anything in my app to set a local or default time > zone, and I have not changed the time zone in my system preferences in a very > long time. (Multiple reboots ago.) Add to that, the code did produce the > correct date a few times earlier tonight... Also, it doesn't seem to make a > difference whether I use systemTimeZone or localTimeZone. >
Did you try to use NSDateComponents for building your reference date (2001/01/01) such as : NSCalendar *cal = [NSCalendar currentCalendar]; NSDateComponents *refDateComps = [[NSDateComponents alloc] init]; [refDateComps setYear:2001]; [refDateComps setMonth:01]; [refDateComps setDay:01]; [refDateComps setHour:0]; [refDateComps setMinute:0]; [refDateComps setSecond:0]; NSDate *refDate = [cal dateFromComponents:refDateComps]; [refDateComps release]; NSDateComponents *dc = [[[NSDateComponents alloc] init] autorelease]; [dc setDay: numdays]; NSDate * cd = [cal dateByAddingComponents: dc toDate: refDate options: 0]; K._______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
