Hello friends I am trying to convert a hexadecimal to date that must be in utc-5 format peru time
this is the function with which I try to do this conversion:
CREATE OR REPLACE FUNCTION public.hex_timestamp(
text)
RETURNS timestamp without time zone
LANGUAGE 'sql'
COST 100
IMMUTABLE STRICT
AS $BODY$
select
(to_timestamp(('x' || lpad($1, 16, '0'))::bit(64)::bigint / 1000.0))::timestamptz at time zone 'utc-5'
$BODY$;
ALTER FUNCTION public.hex_timestamp(text)
OWNER TO postgres;
and this is my hex value:
0000017B3DB65648
However, the time is not correct since it takes me one day ahead of the current date and the time is not correct either
13/08/2021 04:12:45
I would like you to show me the correct date and time with Peruvian time, this is the correct time that it should show
12/08/2021 23:23:53
thanks for your help