Subject Re: [firebird-support] Posting Question to IBPP Discussion? 2ne Attempt.
Author Helen Borrie
At 03:06 PM 9/12/2004 +0000, you wrote:


>Hi Folks:
>
>[off-topic material snipped]
>
> I"m using IBPP 2.3.1.1.
>
> How do I extract millisecond informatin from
>a timestamp?

The EXTRACT(SECOND FROM MyTimestamp) function returns the seconds as a
DECIMAL(6,4). To compute the subsecond portion you would need to apply the
external (fbudf) function TRUNCATE, using an expression like

EXTRACT(SECOND FROM MyTimestamp) - TRUNCATE( EXTRACT(SECOND FROM MyTimestamp) )

But there's a gotcha here. If you stored MyTimeStamp by capturing the
system date/time (CURRENT_TIMESTAMP or CURRENT_TIME) then the subsecond
portion is always zero. To store an exact timestamp, you need to use the
fbudf function GETEXACTTIMESTAMP(), which takes no arguments and returns a
fully-populated timestamp.

./heLen