dateDiff issue with timestamp

#1 - Using a timestamp from a data set through direct query,
payment_date produces “… generated a SQL error…”

dateDiff({payment_date},now(),“MM”)

#2 - Creating dates and then using dateDiff does work on a table visual …
today: now()
test: addDateTime(2,‘YYYY’,parseDate(‘02-JUL-2018’, ‘dd-MMM-yyyy’) )
test2: dateDiff(test, today, “DD”)

#3 - changing test to have a timestamp produces same issue as #1
addDateTime(2,‘YYYY’,parseDate(‘02-JUL-2018 12:20:30’, ‘MM/dd/yyyy HH:mm:ss’) )

Hi @kph

It looks like formatting issue. can you share error details from the data source ?
and, try updating the timestamp filed formatting with FormatDate or ParseDate calculation in dataset and then use it in the analysis.

Thank you for the direction.

error →
ERROR: function pg_catalog.date_diff(“unknown”, timestamp with time zone, timestamp with time zone) does not exist Hint: No function matches the given name and argument types. You may need to add explicit type casts.

I ended up with this for now. I may need to revisit if timezone conversion is needed.
dateDiff(parseDate(toString({first_date}),“yyyy-MM-dd”),parseDate(toString({payment_date}), “yyyy-MM-dd”),“DD”)