• 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: Fri, 12 Mar 2004 12:40:01 +0100

Thanks Art, I have sorted it out at last.  One of the biggest problems I had
when creating the fromDate and toDate timestamps was a confusion over the
time zone.  I noticed that when I created them, and printed them to the log,
they were displaying as GMT (not CET) timezone and the times were one hour
behind.  I am assuming that this is adjusted for the system time zone before
any comparison (this seems true from the tests I have done) and that all
timstamps are related to GMT.  This appears to be what it says in the API.
Also, it took a while before I noticed the section stating that the months
are returned as 0-11 instead of 1-12.  Little things like this that make
things so complicated!   Anyway, it seems to work now.  Thanks for the help!

Regards,
Dave.

> 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.
_______________________________________________
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.


References: 
 >Re: Comparing Dates & Timestamps (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: WORepetition problem
  • Next by Date: (Non-Direct) JavaClient using JBuilder or Eclipse or ... (for a WO app)
  • Previous by thread: Re: Comparing Dates & Timestamps
  • Next by thread: Re: Comparing Dates & Timestamps
  • Index(es):
    • Date
    • Thread