• 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: Comparing Dates & Timestamps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing Dates & Timestamps


  • Subject: Re: Comparing Dates & Timestamps
  • From: David Griffith <email@hidden>
  • Date: Thu, 11 Mar 2004 22:51:26 +0100

Thanks Art,

> On Mar 11, 2004, at 9:49 AM, David Griffith wrote:
>
>> I have a date prototype which using the internal value 'Date' - this
>> shows
>> as an NSCalendarDate in EOModeler
>
> Sounds like EOModeler is configured to include the "Value Class
> (Obj-C)" column instead of "Value Class".  You might want to delete the
> "Value Class (Obj-C)" column (select the column and press the "Delete"
> key) and add "Value Class".  But this won't have any effect on the
> eomodel itself.
>

Well both columns contain the same NSCalendarDate in this instance.  I have
removed the Value Class (Obj-C) column, however is NSCalendarDate the
incorrect Value Class?  I actually looked it up earlier and noticed it was
on Obj-C class.  That is the default that EOModeler gave me when I select
internal type of Date.

>> Now I want to fetch or filter records where:
>>
>> OrderDate = todaysDate
>>
>> Can someone tell me an easy way? I have been fiddling with calendars
>> etc but
>> not having much luck.  I know I can get a new NSTimestamp, but since
>> this
>> includes the time also it will not match.
>
> You could get a new NSTimestamp and remove the hours, minutes, and
> seconds, but that requires mucking with Java's very clumsy date classes
> as you've probably noticed.  I think it's rarely safe to compare
> timestamps for equality.  Instead, test that a timestamp is within a
> range of timestamps (untested pseudocode follows):
>
> NSTimestamp today = new NSTimestamp();
> NSTimestamp yesterday = today.timestampByAddingGregorianUnits(0, 0,
> -1, 0, 0, 0);
> EOQualifier qualifier =
> EOQualifier.qualifierWithQualifierFormat("orderDate > %@ and orderDate
> <= %@", new NSArray(new NSTimestamp[] {yesterday, today});

I am assuming this will give me timestamps for the current time today, and
the same time yesterday.  I am looking for say a timestamp for today at
00:00:00 and today at 23:59:59 (as I noticed suggested by Chuck in another
post) but I'm not sure how to get that.

Dave.

>
> Aloha,
> Art
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Comparing Dates & Timestamps
      • From: Art Isbell <email@hidden>
    • Re: Comparing Dates & Timestamps
      • From: David Elsner <email@hidden>
    • Re: Comparing Dates & Timestamps
      • From: Jonathan Rochkind <email@hidden>
References: 
 >Re: Comparing Dates & Timestamps (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: Comparing Dates & Timestamps
  • Next by Date: Re: Comparing Dates & Timestamps
  • Previous by thread: Re: Comparing Dates & Timestamps
  • Next by thread: Re: Comparing Dates & Timestamps
  • Index(es):
    • Date
    • Thread