Re: [NSDate +dateWithNaturalLanguageString] question
Re: [NSDate +dateWithNaturalLanguageString] question
- Subject: Re: [NSDate +dateWithNaturalLanguageString] question
- From: Deborah Goldsmith <email@hidden>
- Date: Sun, 13 Jul 2008 23:10:58 -0700
On Jul 13, 2008, at 10:34 PM, Charles Srstka wrote:
What I don't get is why there can't just be a
+dateWithYear:month:day:hour:minute:second:timeZone:calendar: method
to replace the current
+dateWithYear:month:day:hour:minute:second:timeZone: one instead of
having to deal with three different classes just to do a simple task
that used to require only one class method. You'd just put the
calendar you wanted to use in the last parameter (or pass nil to
just use the current calendar) and it would do the right thing.
Granted, this seems like the sort of thing that would be pretty easy
to do with a category on NSDate, but I'm just curious why it wasn't
included with the standard distribution.
Different calendars have different components. Several require an era,
which would just be a nuisance for others. How you create a date
depends a lot on where the data to create it is coming form.
You can use dateWithString: if you have data in guaranteed-Gregorian
format. CFCalendarComposeAbsoluteTime also works somewhat the way you
suggest. Finally, if it's a localized text date, you can use
NSDateFormatter or CFDateFormatter to parse it.
If you would like to see a different kind of API added, please file an
enhancement request.
Deborah Goldsmith
Apple Inc.
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden