Subject Re: [firebird-support] X minutes ago
Author Lester Caine
d_dude_2003 wrote:

> I need to select the rows which have the TIMESTAMP field value more
> than X minutes ago from the current moment.
>
> SELECT * FROM VISIT_DETAIL
> WHERE (CHECKOUT_TIMESTAMP IS NULL) AND (CHECKIN_TIMESTAMP
> <= :CHECKIN_TIMESTAMP)
>
> and then i popuplate the query parameter in Delphi application
>
> FQuery.ParamByName('CHECKIN_TIMESTAMP').AsDateTime := Now - X/(24*60);

Where are you getting Now from?

> Looks like something is wrong with this.

What is the error?

> Whats the correct way to do this?

This should work - usual problem is that the date format is wrong. m/d/y
rather than d/m/y but I'm not sure what Delphi passes as 'AsDateTime'

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php