• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSCalendarDate from CoreData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCalendarDate from CoreData


  • Subject: Re: NSCalendarDate from CoreData
  • From: Albert Andersen <email@hidden>
  • Date: Tue, 28 Nov 2006 12:56:56 -0800

 Ever-so-slightly less clunky would be:

NSDate *date = [myManagedThing valueForKey:@"myDate"];
NSCalendarDate *realDate = [date dateWithCalendarFormat:(format) timeZone:(timeZone)];

(See NSDate dateWithCalendarFormat:timeZone: )

You're still making an extra date for conversion, but at least you're not going all the way out to a String and back.

 -Albert

On Tuesday, November 28, 2006, at 12:52PM, "Jim Thomason" <email@hidden> wrote:
>I hope there's a more clever solution, but I'm just not finding it.
>
>I have several dates in my CoreData store, and when I load them up, I
>get back NSCFDate objects. But what I really want are NSCalendarDate
>objects, so I can manipulate them more easily.
>
>I get around this by copying it as such:
>
>NSCalendarDate* realDate = [[NSCalendarDate alloc]
>initWithString:[[myManagedThing valueForKey:@"myDate"] description]];
>
>But this just seems...clunky to me.
>
>Is there a slicker way? Or is this the way to go?
>
>Thanks,
>
>-Jim.....
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>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
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

References: 
 >NSCalendarDate from CoreData (From: "Jim Thomason" <email@hidden>)

  • Prev by Date: NSCalendarDate from CoreData
  • Next by Date: Re: NSCalendarDate from CoreData
  • Previous by thread: NSCalendarDate from CoreData
  • Next by thread: Re: NSCalendarDate from CoreData
  • Index(es):
    • Date
    • Thread