On Dec 22, 2008, at 2:30 PM, mmalc Crawford wrote:
No!
This is precisely the direction in which not to go:
Important: Use of NSCalendarDate strongly discouraged. It is not
deprecated yet, however it may be in the next major OS release after
Mac OS X v10.5. For calendrical calculations, you
Hi,
Apologies in advance for what I think must be a basic question. It's something
I've never had cause to do before, assumed must be fairly straightforward, and
then seemed a lot more complicated than it should be which leads me to think
that I am using the wrong search terms...
All I want
Fun problem
Basically it's safe to assume 24 hours in a day for date calculation
(check details at Wikipedia) so you just have to get January 1 of the
target year, January 1 of the subsequent year and increment until the
time interval between them equals zero. This makes no assumptions
Hi Keith,
Ken's suggestion is much more elegant than mine, but here's mine
anyway. I wrote a little Foundation Tool to test it and it works fine.
Note that the year (2009), and the fact that 2009 is not a leap year,
are hard-coded. You'll have to change that, of course.
Hope this helps.
Hi,
Many thanks to both of you for your very helpful replies - much appreciated!
I've gone with Ken's solution, which works perfectly for what I need. For the
sake of the archives, I've attached the method I created based on Ken's code,
which just creates a hierarchical dictionary of objects
On Dec 22, 2008, at 8:34 AM, Keith Blount wrote:
Hi,
Many thanks to both of you for your very helpful replies - much
appreciated! I've gone with Ken's solution, which works perfectly
for what I need. For the sake of the archives, I've attached the
method I created based on Ken's code,
On Dec 22, 2008, at 4:53 AM, Keith Blount wrote:
Hi,
Apologies in advance for what I think must be a basic question. It's
something I've never had cause to do before, assumed must be fairly
straightforward, and then seemed a lot more complicated than it
should be which leads me to think
On Dec 22, 2008, at 8:47 AM, mmalc Crawford wrote:
There shouldn't be any need, though, to add a month for each
iteration, just start a new month with a date components object with
a new month number.
This could be made a little more efficient (and if you're not using
garbage
On Dec 22, 2008, at 9:22 AM, Nathan Vander Wilt wrote:
[Good advice, except:]
NSCalendar can handle overflow, so you can have an NSDateComponent
that says something like Year:2008 Month:1 Days:364 and you will
get the right date from components.
You should not rely on this behaviour.
(less
nasty :) ) methods.
Thanks again!
Keith
--- On Mon, 12/22/08, mmalc Crawford mmalc_li...@me.com wrote:
From: mmalc Crawford mmalc_li...@me.com
Subject: Re: NSCalendar/NSDate - generating all months/days in a year [SOLVED]
To: Cocoa-Dev List cocoa-dev@lists.apple.com
Cc: Keith Blount
Following everyone's advice, I came up with the following, more
compact, solution
- (NSDictionary *) dates:(int) inYear
{
NSMutableDictionary *result =
[NSMutableDictionary dictionary];
NSMutableArray *days =
On Dec 22, 2008, at 11:20 AM, Ken Tozier wrote:
NSCalendarDate *date = [NSCalendarDate dateWithYear: ...
No!
This is precisely the direction in which not to go:
Important: Use of NSCalendarDate strongly discouraged. It is not
deprecated yet, however it may be in the next major OS release
On Mon, 22 Dec 2008 12:01:11 -0800, mmalc Crawford
mmalc_li...@me.com said:
On Dec 22, 2008, at 11:48 AM, Kenneth Bruno wrote:
Basically, NSCalendarDate gets you pretty much what you need:
As in a recent message:
Important: Use of NSCalendarDate strongly discouraged. It is not
13 matches
Mail list logo