See NSCalendar.h. Given an NSCalendar instance that you've
configured with the appropriate Locale and TimeZone, you can use
the following methods to convert between an NSDate and
corresponding NSDateComponents:
With the date in component form, you can read and modify its era as
desired:
- (NSInt)era;
- (void)setEra:(NSInt)v;
...in theory, that is.
Unfortunately there is a bug affecting -components:fromDate: that I
had momentarily forgotten about, which prevents this technique from
being usable at present. (Thanks to Mark Ackerman for reminding me
off-list.)
A fix for -components:fromDate: and -
components:fromDate:toDate:options: is coming in the next software
update. In the meantime, you will need to use the CoreFoundation's
CFCalendar API to perform era manipulation, as noted in the list
archives:
(For manipulation of other date components, there is also the legacy
NSCalendarDate class, but it does not provide era access or support
calendars other than Gregorian.)
Sorry for confusing matters!
--
Troy Stephens
Cocoa Frameworks
Apple Computer, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden