Re: CoreData Date Problems
Re: CoreData Date Problems
- Subject: Re: CoreData Date Problems
- From: John Timmer <email@hidden>
- Date: Wed, 27 Jul 2005 07:57:39 -0400
This is one of the relatively minor annoyances of CoreData - things that
come through the valueForKey or bindings are typically not the calendar
dates you define in your object model. To compensate for that, I typically
use the following line of code:
tmpDate = [NSCalendarDate dateWithTimeIntervalSince1970: [[entry
valueForKey: @"theDate"] timeIntervalSince1970]];
> I have an attribute that is of type date.
>
> I am trying to use the following code to convert the date into a
> NSCalendarDate from the results of a NSFetchRequest:
>
> NSManagedObject* aTask = [results ObjectAtIndex:loop];
>
> NSCalendarDate* thisDate = [aTask valueForKey:@"dueDate"];
>
> NSLog([thisDate descriptionWithCalendarFormat:@"%a %m/%d/%y %I:%M %p"]);
>
> When I try to use the thisDate object I get the following error:
>
> -[NSCFDate descriptionWithCalendarFormat:]: selector not recognized
> [self = 0x502ff90]
>
> String values can be extracted from the attribute without any problems.
>
> The entry in the XML for it looks like this:
>
> <attribute name="duedate" type="date">144111600.00000000000000000000</
> attribute>
>
> Any ideas?
>
_______________________________________________
This mind intentionally left blank
_______________________________________________
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