How to update a Firebird timestamp field to remove part of a millisecond?

Is there a simple update statement that I can execute to update the timestamp field in the firebird database to remove the millisecond part.

so the current value is: 9-DEC-2013 8: 55: 57.3560 I want to update it: 9-DEC-2013 8: 55: 57.0000

I need a generic update statement that computes a new timestamp based on an old timestamp.

+4
source share
3 answers

Firebird does not have a standard feature for this. However, using the built-in functions EXTRACT, DATEADDyou can build it.

DATEADD(-1 * EXTRACT(MILLISECOND FROM theTimestamp) MILLISECOND TO theTimestamp)

, , 100 , DATEADD :

<amount>:: = ( )

100 . CORE-4457, .

, , , , ( CURRENT_TIME CURRENT_TIMESTAMP ).

+4
+1
v_TimeIn = cast(extract(Hour from v_TimeIn)||':'||
    extract(minute from v_TimeIn) as Time);
+1

Source: https://habr.com/ru/post/1543848/


All Articles