Subject Re: X minutes ago
Author Adam
--- In firebird-support@yahoogroups.com, Lester Caine <lester@...> wrote:
>
> 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?

Now is a delphi function that returns local time as a TDateTime (in
System unit I think).

> 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'

It is a parametised query so there are no regional date format
settings to speak of. You only need to worry about this for non
paramtised queries.

If D_Dude is serious about getting support, he or she will tell us
something useful, like what problem they perceive to be occurring.

Apart from the select * (fields should be deliberately specified), it
looks fine to me. If you are not receiving data you expect, don't
forget transaction isolation.

Adam