__IF_EXISTS__
SELECT 1
	FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW45000_BPSCHEMA_UGBUPD-9943.SQL'
	AND END_DTTM IS NOT NULL
/
__THEN__

__EXIT__

__ENDIF__

create or replace FUNCTION DST_TO_UTC_CONVERTER (dateTimeField IN DATE, legalTimeZone IN VARCHAR2, offsetTime IN VARCHAR2)
    RETURN VARCHAR2
    IS convertedOutput VARCHAR2(32);
    BEGIN
        convertedOutput := TO_CHAR(FROM_TZ(CAST(dateTimeField AS TIMESTAMP), legalTimeZone) AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"hh24:mi:ss"Z"');
        RETURN convertedOutput;
    EXCEPTION
        WHEN others THEN
            convertedOutput := TO_CHAR(FROM_TZ(CAST(dateTimeField AS TIMESTAMP), offsetTime) AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"hh24:mi:ss"Z"');
            RETURN convertedOutput;
    END;
/