Re: NSDatePicker / NSDatePickerCell
Re: NSDatePicker / NSDatePickerCell
- Subject: Re: NSDatePicker / NSDatePickerCell
- From: Troy Stephens <email@hidden>
- Date: Fri, 16 Sep 2005 10:12:34 -0700
On Sep 15, 2005, at 1:31 PM, Troy Stephens wrote:
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:
- (NSDate *)dateFromComponents:(NSDateComponents *)comps;
- (NSDateComponents *)components:(NSUInt)unitFlags fromDate:(NSDate
*)date;
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:
http://lists.apple.com/archives/cocoa-dev/2005/May/msg02444.html
(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:
This email sent to email@hidden