• 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: Art Isbell <email@hidden>
  • Date: Thu, 11 Mar 2004 11:12:58 -1000

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.


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});


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.


  • Follow-Ups:
    • Re: Comparing Dates & Timestamps
      • From: David LeBer <email@hidden>
    • Re: Comparing Dates & Timestamps
      • From: David Griffith <email@hidden>
References: 
 >Comparing Dates & Timestamps (From: David Griffith <email@hidden>)

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