This is done in DB2 on a iSeries so some you may need to edit it some. In particular ant line that *SomeWord is probably a iSeries thing.
CREATE FUNCTION YFUALFA.TIMESTAMP_EPOCH ( EPOCH BIGINT ) RETURNS TIMESTAMP LANGUAGE SQL SPECIFIC YFUALFA.TIMESTAMP_EPOCH DETERMINISTIC READS SQL DATA RETURNS NULL ON NULL INPUT NO EXTERNAL ACTION SET OPTION ALWBLK = *ALLREAD , ALWCPYDTA = *OPTIMIZE , COMMIT = *NONE , DECRESULT = (31, 31, 00) , DFTRDBCOL = *NONE , DYNDFTCOL = *NO , DYNUSRPRF = *USER , SRTSEQ = *HEX RETURN TIMESTAMP ( '1970-01-01' , '00:00:00' ) + EPOCH SECONDS ; COMMENT ON SPECIFIC FUNCTION YFUALFA.TIMESTAMP_EPOCH IS 'Timestamp from a Java epoch' ;