dbTalk Databases Forums  

comparing timestamps

comp.databases.filemaker comp.databases.filemaker


Discuss comparing timestamps in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Guy
 
Posts: n/a

Default comparing timestamps - 10-29-2010 , 11:35 AM






I have two fields, one a to-do date and another the current date... both are
timestamp fields.

If the date/time is past, I need to alert, otherwise do something else.

If the date is the same, regardless of the time (before or after), I get a
"past"...
eg. 10/29/2010 6:00 PM shows "past" even at 10/29/2010 6:00 AM.

If I structure two scratch fields, (both number), then the tests work as
expected.

WIN XP 10.0 Adv

Help is appreciated.

--
-------------------------------------------------
Captain Guy
100ton-Sail-Towing-Coastal
Deliveries & Instruction-Power & Sail
New Smyrna Beach FL USA
386-689-5088
-------------------------------------------------
s/v Island Time (Beneteau 352#277)
AICW 845.5

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: comparing timestamps - 10-29-2010 , 08:55 PM






In article <pOCdnb3ijf5YalfRnZ2dnUVZ_jidnZ2d (AT) earthlink (DOT) com>, "Guy"
<guy (AT) guym (DOT) com> wrote:

Quote:
I have two fields, one a to-do date and another the current date... both are
timestamp fields.

If the date/time is past, I need to alert, otherwise do something else.

If the date is the same, regardless of the time (before or after), I get a
"past"...
eg. 10/29/2010 6:00 PM shows "past" even at 10/29/2010 6:00 AM.

If I structure two scratch fields, (both number), then the tests work as
expected.

WIN XP 10.0 Adv

Help is appreciated.
How is the data put into the two Fields?? How are you comparing the two??

My guess is that you are hitting this problem because of seconds and
fractions of seconds which are stored within Timestamp Fields.

Although the Fields may display as just "10/29/2010 6:00 PM" (depending on
formatting options), they can actually store something like "10/29/2010
6:00:17.4553 PM". Obviously this of course means getting an exact match is
near impossible since "10/29/2010 6:00:00.0000 PM" is in the past of
"10/29/2010 6:00:00.0001 PM"

The best option would be to take the difference between the two Timestamp
Fields and compare that against whatever is the definition of "past". For
example, if you are saying something more than 10 minutes (measured in
seconds) old is "past", then your comparison test would be:

If (CurrentDate - ToDoDate > 10 * 60)
{Perform "Past" functions}
Else
{Perform "NOT Past" functions}
End If


Helpful Harry )

Reply With Quote
  #3  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Re: comparing timestamps - 10-30-2010 , 04:25 AM



Guy <guy (AT) guym (DOT) com> wrote:

Quote:
I have two fields, one a to-do date and another the current date... both are
timestamp fields.
So the second field is a calc field that shows the current system
timestamp? Make sure it is no stored, otherwise it won't refresh.
--
http://clk.ch

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.