How to Create a Function in Postgresql Using Pgadmin 4?
create or replace function myFunction(x TIMESTAMP, y TIMESTAMP)
returns TIMESTAMP
language plpgsql
as
$$
declare
fechatimestamp TIMESTAMP;
begin
fechatimestamp:=null;
fechatimestamp:= TO_DATE(to_char(d) ||’ ‘ || TO_CHAR(lpad(TO_CHAR(x),6, ‘0’)), ‘yyyymmdd hh24:mi:ss’);
RETURN fechatimestamp;
end;
$$;