Subject Re: [ib-support] How can I convert TIMESTAMP to DOUBLE PRECISION???
Author Claudio Valderrama C.
<lester@...> wrote in message news:3C6E78DC.D106E2A0@......
>
> My point was that you can just treat timestamps as numbers
> when you want to use them like that. The problem I see is
> that intermediate code can convert them to any format of
> date or time layout - but for my applications I don't need (
> or want ) a conversion from the internal number. In most
> cases I am looking for the duration since the last event, or
> the number of days since a last visit.

The problem is WHERE are you dealing with those numbers. Delphi and BCB's
innacurate representation of timestamps in a double precision type is
different from the exact integral representation that the engine keeps of
timestamps. You know the tricks you can do with a Delphi's TDateTime, but
they don't have to match necessarily the operations you have to do with an
IB/FB timestamp to add seconds, for example (a date+1 means one day more, a
timestamp+1 means again one day more and a time+1 means one second more).
Furthermore, you will have better luck manipulating the time part of a
TDateTime in Delphi than in FB due to the dialect 3 rules for the decimal
places, so I created a bunch of Add* functions in the fbudf.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing