Postgres: convert timestamp into readable date time
CREATE FUNCTION fromepoch(inputtime bigint) RETURNS text
AS $$
DECLARE
retval TEXT;
BEGIN
SELECT TIMESTAMP WITH TIME ZONE 'epoch' + inputtime/1000 * INTERVAL '1
second' INTO retval;
RETURN retval;
END;
$$ LANGUAGE plpgsql;
ALTER FUNCTION public.fromepoch(inputtime bigint) OWNER TO myrack_staging;
Paste into your Postgresql connection.
It will create a fromepoch(bigint) function within the db.
0 Comments:
Post a Comment
<< Home