Grafana: Unable to use__fromπŸ“…date_format in db function call

I need to call a database function from grafana.
Function definition is as below

CREATE OR REPLACE FUNCTION functionTest( fromTime TIMESTAMP, toTime TIMESTAMP)
RETURNS
TEXT AS
$$
DECLARE
result text = β€˜β€™;
begin
…
RETURN result;
END;
$$
LANGUAGE plpgsql;

After creation when I tested it manually through SQL Editor using Query-1. It works fine:
Query-1: select functionTest(timestamp β€˜2020-01-23 06:54:13’, timestamp β€˜2020-01-24 06:54:13’)

When I try to call this function through grafana it gives me error.
I tried to create one query variable and used below syntax to call the function as explained https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/
I get error as

Templating
Template variables could not be initialized: pq: invalid input syntax for type timestamp: "[[__from:date:YYYY-MM-DD HH:mm:ss]]"

Query-2: select functionTest(timestamp β€˜[[__from:date:YYYY-MM-DD HH:mm:ss]]’, timestamp β€˜[[__to:date:YYYY-MM-DD HH:mm:ss]]’);

When I used Query-1 just for verification purpose then it worked as expected.

Am I using the correct syntax?
Anyone any idea as what is wrong with the above syntax? Any quick help would be highly appreciated.

Any input from anyone on this?