Re: Comparing Dates & Timestamps
Re: Comparing Dates & Timestamps
- Subject: Re: Comparing Dates & Timestamps
- From: Art Isbell <email@hidden>
- Date: Thu, 11 Mar 2004 14:00:58 -1000
On Mar 11, 2004, at 1:09 PM, David Griffith wrote:
Yes, I want to compare today's date against the date that was stored
in the
database, which as I said is stored as an NSCalendarDate and in the
database
it has the form "2004-03-11". However, when I try and filter the list
with:
NSTimestamp today = new NSTimestamp();
....
bindings.addObject(distributor);
bindings.addObject(today);
distQualifier = EOQualifier.qualifierWithQualifierFormat("distributor
= %@
AND orderDateShipped= %@", bindings);
I get no results. This has to be because of the timestamp having more
info
I guess,
That's correct and why I almost never compare dates for equality
regardless of whether the DB value contains hours, minutes, and
seconds. That's why I suggested "orderDateShipped > now_minus_one_day
and orderDateShipped <= now". This expression will always match today
at midnight (which is what a FrontBase Date is), even if now is exactly
midnight. However, if the DB date value contains hours, minutes, and
seconds, matching all timestamps in one day is best done using
"orderDateShipped >= midnight_today and orderDateShipped <
midnight_tommorrow".
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.