CREATE OR REPLACE FUNCTION "schema1"."utils.Get_datetime" ( in in_datetime_string varchar(4000), out out_datetime timestamp
) AS $$ DECLARE ok boolean; BEGIN ok := true; IF in_datetime_string is not null then BEGIN out_datetime := to_timestamp(in_datetime_string, 'MM/DD/YYYY HH24:MI:SS'); ok := true; EXCEPTION when others then ok := false; END; ELSE ok := true; END IF; END; $$ language plpgsql;
where schema1 is the schema
"utils.Get_datetime"function name
The query "select * from "schema1"."utils.Get_datetime"('02/02/2016 02:22:35');" returns the correct result.
OS Version: Windows 2012 R2
pgAdmin 4 Version: Version1.1
Python Version: 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)]