• 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 12:37:07 -1000

On Mar 11, 2004, at 11:51 AM, David Griffith wrote:

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.

If I recall correctly, EOModeler stores "NSCalendarDate" in the eomodel, probably for historic reasons (Obj-C preceded Java as an EOF implementation language). But for WO 5, an NSTimestamp is instantiated instead of an NSCalendarDate. So as far as the eomodel is concerned, its contents are identical whether you display "Value Class (Obj-C)" or "Value Class" in EOModeler.


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.

You stated that you wanted to compare a Date column for equality. Because a Date doesn't include hours, minutes, and seconds, it doesn't matter that the NSTimestamps being used for comparisons include hours, minutes, and seconds. There is only one Date between the current time today and that same time yesterday. No need to do the extra work to set hours, minutes, and seconds to 0 (i.e., midnight).


There's also no need to use 23:59:59 for a comparison; in fact, it might not return the correct results in those databases that store time in millisecond precision. To match all of today, "orderDate >= today_00:00:00 and orderDate < tomorrow_00:00:00" is more correct than "orderDate >= today_00:00:00 and orderDate <= today_23:59:59".

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 Griffith <email@hidden>
References: 
 >Re: Comparing Dates & Timestamps (From: David Griffith <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