Skip to content

Instantly share code, notes, and snippets.

@kovid-rathee
Created February 23, 2019 19:04
Show Gist options
  • Save kovid-rathee/86dc1a14d402b89a255ddc4a2bc9ce60 to your computer and use it in GitHub Desktop.
Save kovid-rathee/86dc1a14d402b89a255ddc4a2bc9ce60 to your computer and use it in GitHub Desktop.
Convert Timestamp to ISO-8601 Date format (YYYYMMDD)
drop function if exists transformation_utils.ts_to_isodate (p_timestamp timestamp);
create or replace function transformation_utils.ts_to_isodate (p_timestamp timestamp)
returns integer AS
$body$
declare
d integer;
begin
select to_char(p_timestamp::timestamp, 'YYYYMMDD') into d;
return d;
end;
$body$
language 'plpgsql';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment