DATETIME_DIFF with a column containing date strings

I want to calculate the difference between NOW() and a formula column containing strings formatted as “yyyy/mm/dd”.

As per the documentation, DATETIME_DIFF can take strings formatted as yyyy/mm/dd. This works for constant but for columns I get the error the “field with string type found when date expected”

AFAIK, DATETIME_DIFF always was designed to work with DATE / DATETIME fields. Where did you find reference explaining it works with text?

For now, as a quick workaround, you can convert columns of type string to date/date time - and use this formula.

Hi dstala,

  1. Please see the screenshot below. I found this on the docs for DATETIME_DIFF.

  2. How to convert strings to Date/DateTime. I couldn’t find any function for the same in the docs.

You can change the field type, from single line text to Date.

We will add more specific details to the document. DATETIME_DIFF supports arguments of only date & datetime type.

1 Like

I have a column of strings that comes from another source whose field type is string and I don’t want to modify the same.
How can I create a new column that stays in sync with the column containing strings but with the field type of Datetime ?

You will have to rely on Scripts & use API.

Currently, duplicate column doesn’t duplicate data & there is no defined way to keep two columns in sync.

A formula column with a function for converting strings to datetime is what I was looking for.
I will see if I can try to emulate this with the API.
Thanks