I explored a lot. I am using this to convert epoch time to date:
CASE
WHEN json_extract_path_text(cli, 'pickupDate') IS NULL OR json_extract_path_text(cli, 'pickupDate') = ''
THEN DATEADD(SECOND, CONVERT(bigint, json_extract_path_text(cli, 'pickupTime')), '1970-1-1'), '1970-1-1' )
ELSE json_extract_path_text(cli, 'pickupDate')
END AS "Start Date"
To give little context, if the key 'pickupDate' in json is not present, i need to make use of this key 'pickUpTime' to get the value. When i do this, i get this error:
Invalid operation: CASE types text and timestamp without time zone cannot be matched; 1 statement failed.
Can someone help me out here? How do we specify timezone or if there is another way to resolve this?