CREATE OR REPLACE FUNCTION utcmillis (in db2ts timestamp)
returns bigint
language sql
deterministic
no external action
return (
bigint((days(db2ts - current timezone) - days('1970-01-01-00.00.00.000000')) * 86400 + midnight_seconds(db2ts - current timezone))*1000 + microsecond(db2ts)/1000
);
CREATE OR REPLACE FUNCTION utcmillis (in db2ts timestamp) returns bigint language sql deterministic no external action return ( bigint((days(db2ts - current timezone) - days('1970-01-01-00.00.00.000000')) * 86400 + midnight_seconds(db2ts - current timezone))*1000 + microsecond(db2ts)/1000 );